From e6576248e5174ca5daa362cfd610c07e7eb3a2ae Mon Sep 17 00:00:00 2001 From: Aviv Palivoda Date: Thu, 9 May 2019 21:05:45 +0300 Subject: [PATCH] bpo-30262: Don't expose private objects in sqlite3 (GH-1440) The Cache and Statement objects are undocumented and implementation details of the sqlite3 module. They aren't usable from pure Python code. --- Doc/whatsnew/3.8.rst | 4 ++++ .../next/Library/2019-05-09-12-38-40.bpo-30262.Tu74ak.rst | 2 ++ Modules/_sqlite/module.c | 4 ---- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2019-05-09-12-38-40.bpo-30262.Tu74ak.rst diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index d21a4c7944..49a6cb0788 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -796,6 +796,10 @@ The following features and APIs have been removed from Python 3.8: * "unicode_internal" codec is removed. (Contributed by Inada Naoki in :issue:`36297`.) +* The ``Cache`` and ``Statement`` objects of the :mod:`sqlite3` module are not + exposed to the user. + (Contributed by Aviv Palivoda in :issue:`30262`.) + Porting to Python 3.8 ===================== diff --git a/Misc/NEWS.d/next/Library/2019-05-09-12-38-40.bpo-30262.Tu74ak.rst b/Misc/NEWS.d/next/Library/2019-05-09-12-38-40.bpo-30262.Tu74ak.rst new file mode 100644 index 0000000000..059bd71783 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-09-12-38-40.bpo-30262.Tu74ak.rst @@ -0,0 +1,2 @@ +The ``Cache`` and ``Statement`` objects of the :mod:`sqlite3` module are not +exposed to the user. Patch by Aviv Palivoda. diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 274ee13c37..c487ba9890 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -366,10 +366,6 @@ PyMODINIT_FUNC PyInit__sqlite3(void) PyModule_AddObject(module, "Connection", (PyObject*) &pysqlite_ConnectionType); Py_INCREF(&pysqlite_CursorType); PyModule_AddObject(module, "Cursor", (PyObject*) &pysqlite_CursorType); - Py_INCREF(&pysqlite_CacheType); - PyModule_AddObject(module, "Statement", (PyObject*)&pysqlite_StatementType); - Py_INCREF(&pysqlite_StatementType); - PyModule_AddObject(module, "Cache", (PyObject*) &pysqlite_CacheType); Py_INCREF(&pysqlite_PrepareProtocolType); PyModule_AddObject(module, "PrepareProtocol", (PyObject*) &pysqlite_PrepareProtocolType); Py_INCREF(&pysqlite_RowType); -- 2.40.0