From 1bde13b0e99592fbfce3538b27ada29ea09840a6 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 11 Aug 2025 09:16:54 +0300 Subject: [PATCH 1/2] Add test for opening an SQLite with bytes path (GH-136331) --- Lib/test/test_sqlite3/test_dbapi.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 3602726437d8cf..74a511ba7c88c2 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -630,6 +630,14 @@ def test_deserialize_corrupt_database(self): class OpenTests(unittest.TestCase): _sql = "create table test(id integer)" + def test_open_with_bytes_path(self): + path = os.fsencode(TESTFN) + self.addCleanup(unlink, path) + self.assertFalse(os.path.exists(path)) + with contextlib.closing(sqlite.connect(path)) as cx: + self.assertTrue(os.path.exists(path)) + cx.execute(self._sql) + def test_open_with_path_like_object(self): """ Checks that we can successfully connect to a database using an object that is PathLike, i.e. has __fspath__(). """ From 70218b40082396d68c277667fc9bb7f87d095e3c Mon Sep 17 00:00:00 2001 From: da-woods Date: Mon, 11 Aug 2025 12:18:37 +0100 Subject: [PATCH 2/2] Fix documentation of hash in PyHash_FuncDef (#137595) Because of a small typo, it wasn't showing up in the generated docs. --- Doc/c-api/hash.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/hash.rst b/Doc/c-api/hash.rst index 00f8cb887dc7eb..b5fe93573a1456 100644 --- a/Doc/c-api/hash.rst +++ b/Doc/c-api/hash.rst @@ -51,7 +51,7 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`. Hash function definition used by :c:func:`PyHash_GetFuncDef`. - .. c::member:: Py_hash_t (*const hash)(const void *, Py_ssize_t) + .. c:member:: Py_hash_t (*const hash)(const void *, Py_ssize_t) Hash function.