https://github.com/python/cpython/commit/a0193479475a047b223f64130867a63b672c8dc2
commit: a0193479475a047b223f64130867a63b672c8dc2
branch: main
author: Hugo van Kemenade <[email protected]>
committer: hugovk <[email protected]>
date: 2024-05-10T20:42:34Z
summary:
gh-118924: Remove `sqlite3.version` and `sqlite3.version_info` (#118925)
files:
A Misc/NEWS.d/next/Library/2024-05-10-22-59-01.gh-issue-118924.9nyvSH.rst
M Doc/library/sqlite3.rst
M Doc/whatsnew/3.13.rst
M Doc/whatsnew/3.14.rst
M Lib/sqlite3/__init__.py
M Lib/sqlite3/dbapi2.py
M Lib/test/test_sqlite3/test_dbapi.py
M Misc/NEWS.d/3.12.0a1.rst
M Modules/_sqlite/module.c
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 6da8798ddfe0c0..5dc22a7e431ae4 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -545,26 +545,6 @@ Module constants
.. versionchanged:: 3.11
Set *threadsafety* dynamically instead of hard-coding it to ``1``.
-.. data:: version
-
- Version number of this module as a :class:`string <str>`.
- This is not the version of the SQLite library.
-
- .. deprecated-removed:: 3.12 3.14
- This constant used to reflect the version number of the ``pysqlite``
- package, a third-party library which used to upstream changes to
- :mod:`!sqlite3`. Today, it carries no meaning or practical value.
-
-.. data:: version_info
-
- Version number of this module as a :class:`tuple` of :class:`integers
<int>`.
- This is not the version of the SQLite library.
-
- .. deprecated-removed:: 3.12 3.14
- This constant used to reflect the version number of the ``pysqlite``
- package, a third-party library which used to upstream changes to
- :mod:`!sqlite3`. Today, it carries no meaning or practical value.
-
.. _sqlite3-dbconfig-constants:
.. data:: SQLITE_DBCONFIG_DEFENSIVE
@@ -597,6 +577,8 @@ Module constants
https://www.sqlite.org/c3ref/c_dbconfig_defensive.html
SQLite docs: Database Connection Configuration Options
+.. deprecated-removed:: 3.12 3.14
+ The :data:`!version` and :data:`!version_info` constants.
.. _sqlite3-connection-objects:
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 37c857dd8197e5..e69320e822ab3b 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -1636,7 +1636,7 @@ Pending Removal in Python 3.14
* :mod:`sqlite3`:
- * :data:`~sqlite3.version` and :data:`~sqlite3.version_info`.
+ * :data:`!version` and :data:`!version_info`.
* :meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany`
if :ref:`named placeholders <sqlite3-placeholders>` are used and
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index 52a24d1a9295a3..bcb1098f43d5a3 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -104,16 +104,30 @@ Removed
argparse
--------
-* The *type*, *choices*, and *metavar* parameters
- of :class:`!argparse.BooleanOptionalAction` are removed.
+* Remove the *type*, *choices*, and *metavar* parameters
+ of :class:`!argparse.BooleanOptionalAction`.
They were deprecated since 3.12.
+collections.abc
+---------------
+
+* Remove :class:`!collections.abc.ByteString`. It had previously raised a
+ :exc:`DeprecationWarning` since Python 3.12.
+
+
email
-----
-* The *isdst* parameter has been removed from :func:`email.utils.localtime`.
+* Remove the *isdst* parameter from :func:`email.utils.localtime`.
(Contributed by Hugo van Kemenade in :gh:`118798`.)
+itertools
+---------
+
+* Remove :mod:`itertools` support for copy, deepcopy, and pickle operations.
+ These had previously raised a :exc:`DeprecationWarning` since Python 3.12.
+ (Contributed by Raymond Hettinger in :gh:`101588`.)
+
pathlib
-------
@@ -122,6 +136,18 @@ pathlib
:meth:`~pathlib.PurePath.is_relative_to`. In previous versions, any such
arguments are joined onto *other*.
+sqlite3
+-------
+
+* Remove :data:`!version` and :data:`!version_info` from :mod:`sqlite3`.
+ (Contributed by Hugo van Kemenade in :gh:`118924`.)
+
+typing
+------
+
+* Remove :class:`!typing.ByteString`. It had previously raised a
+ :exc:`DeprecationWarning` since Python 3.12.
+
Others
------
@@ -129,14 +155,6 @@ Others
It had previously raised a :exc:`DeprecationWarning` since Python 3.9.
(Contributed
by Jelle Zijlstra in :gh:`118767`.)
-* :class:`!typing.ByteString` and :class:`!collections.abc.ByteString`
- are removed. They had previously raised a :exc:`DeprecationWarning`
- since Python 3.12.
-
-* :mod:`itertools` support for copy, deepcopy, and pickle operations.
- These had previously raised a :exc:`DeprecationWarning` since Python 3.12.
- (Contributed by Raymond Hettinger in :gh:`101588`.)
-
Porting to Python 3.14
======================
diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py
index 927267cf0b92ff..34a9c047dd607c 100644
--- a/Lib/sqlite3/__init__.py
+++ b/Lib/sqlite3/__init__.py
@@ -55,16 +55,3 @@
"""
from sqlite3.dbapi2 import *
-from sqlite3.dbapi2 import (_deprecated_names,
- _deprecated_version_info,
- _deprecated_version)
-
-
-def __getattr__(name):
- if name in _deprecated_names:
- from warnings import warn
-
- warn(f"{name} is deprecated and will be removed in Python 3.14",
- DeprecationWarning, stacklevel=2)
- return globals()[f"_deprecated_{name}"]
- raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py
index 56fc0461e6c922..0315760516edf8 100644
--- a/Lib/sqlite3/dbapi2.py
+++ b/Lib/sqlite3/dbapi2.py
@@ -25,9 +25,6 @@
import collections.abc
from _sqlite3 import *
-from _sqlite3 import _deprecated_version
-
-_deprecated_names = frozenset({"version", "version_info"})
paramstyle = "qmark"
@@ -48,7 +45,7 @@ def TimeFromTicks(ticks):
def TimestampFromTicks(ticks):
return Timestamp(*time.localtime(ticks)[:6])
-_deprecated_version_info = tuple(map(int, _deprecated_version.split(".")))
+
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
Binary = memoryview
@@ -97,12 +94,3 @@ def convert_timestamp(val):
# Clean up namespace
del(register_adapters_and_converters)
-
-def __getattr__(name):
- if name in _deprecated_names:
- from warnings import warn
-
- warn(f"{name} is deprecated and will be removed in Python 3.14",
- DeprecationWarning, stacklevel=2)
- return globals()[f"_deprecated_{name}"]
- raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
diff --git a/Lib/test/test_sqlite3/test_dbapi.py
b/Lib/test/test_sqlite3/test_dbapi.py
index 51ce095df41fc1..1f71b5c34e448e 100644
--- a/Lib/test/test_sqlite3/test_dbapi.py
+++ b/Lib/test/test_sqlite3/test_dbapi.py
@@ -48,17 +48,6 @@ def test_api_level(self):
self.assertEqual(sqlite.apilevel, "2.0",
"apilevel is %s, should be 2.0" % sqlite.apilevel)
- def test_deprecated_version(self):
- msg = "deprecated and will be removed in Python 3.14"
- for attr in "version", "version_info":
- with self.subTest(attr=attr):
- with self.assertWarnsRegex(DeprecationWarning, msg) as cm:
- getattr(sqlite, attr)
- self.assertEqual(cm.filename, __file__)
- with self.assertWarnsRegex(DeprecationWarning, msg) as cm:
- getattr(sqlite.dbapi2, attr)
- self.assertEqual(cm.filename, __file__)
-
def test_thread_safety(self):
self.assertIn(sqlite.threadsafety, {0, 1, 3},
"threadsafety is %d, should be 0, 1 or 3" %
diff --git a/Misc/NEWS.d/3.12.0a1.rst b/Misc/NEWS.d/3.12.0a1.rst
index f2438d6608b7af..1f259a64ee4494 100644
--- a/Misc/NEWS.d/3.12.0a1.rst
+++ b/Misc/NEWS.d/3.12.0a1.rst
@@ -3498,7 +3498,7 @@ Illia Volochii.
.. nonce: tjfu9L
.. section: Library
-Deprecate :data:`sqlite3.version` and :data:`sqlite3.version_info`.
+Deprecate :data:`!version` and :data:`!version_info`.
..
diff --git
a/Misc/NEWS.d/next/Library/2024-05-10-22-59-01.gh-issue-118924.9nyvSH.rst
b/Misc/NEWS.d/next/Library/2024-05-10-22-59-01.gh-issue-118924.9nyvSH.rst
new file mode 100644
index 00000000000000..36581dbb9bb11b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-05-10-22-59-01.gh-issue-118924.9nyvSH.rst
@@ -0,0 +1,2 @@
+Remove :data:`!version` and :data:`!version_info` from :mod:`sqlite3`.
+Patch by Hugo van Kemenade.
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index 2c25ee32e58189..698e81d9b897d0 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -714,10 +714,6 @@ module_exec(PyObject *module)
goto error;
}
- if (PyModule_AddStringConstant(module, "_deprecated_version",
PYSQLITE_VERSION) < 0) {
- goto error;
- }
-
if (PyModule_AddStringConstant(module, "sqlite_version",
sqlite3_libversion())) {
goto error;
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]