Skip to content

Commit a019347

Browse files
authored
gh-118924: Remove sqlite3.version and sqlite3.version_info (#118925)
1 parent b309c8e commit a019347

File tree

9 files changed

+36
-74
lines changed

9 files changed

+36
-74
lines changed

Doc/library/sqlite3.rst

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -545,26 +545,6 @@ Module constants
545545
.. versionchanged:: 3.11
546546
Set *threadsafety* dynamically instead of hard-coding it to ``1``.
547547

548-
.. data:: version
549-
550-
Version number of this module as a :class:`string <str>`.
551-
This is not the version of the SQLite library.
552-
553-
.. deprecated-removed:: 3.12 3.14
554-
This constant used to reflect the version number of the ``pysqlite``
555-
package, a third-party library which used to upstream changes to
556-
:mod:`!sqlite3`. Today, it carries no meaning or practical value.
557-
558-
.. data:: version_info
559-
560-
Version number of this module as a :class:`tuple` of :class:`integers <int>`.
561-
This is not the version of the SQLite library.
562-
563-
.. deprecated-removed:: 3.12 3.14
564-
This constant used to reflect the version number of the ``pysqlite``
565-
package, a third-party library which used to upstream changes to
566-
:mod:`!sqlite3`. Today, it carries no meaning or practical value.
567-
568548
.. _sqlite3-dbconfig-constants:
569549

570550
.. data:: SQLITE_DBCONFIG_DEFENSIVE
@@ -597,6 +577,8 @@ Module constants
597577
https://www.sqlite.org/c3ref/c_dbconfig_defensive.html
598578
SQLite docs: Database Connection Configuration Options
599579

580+
.. deprecated-removed:: 3.12 3.14
581+
The :data:`!version` and :data:`!version_info` constants.
600582

601583
.. _sqlite3-connection-objects:
602584

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ Pending Removal in Python 3.14
16361636

16371637
* :mod:`sqlite3`:
16381638

1639-
* :data:`~sqlite3.version` and :data:`~sqlite3.version_info`.
1639+
* :data:`!version` and :data:`!version_info`.
16401640

16411641
* :meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany`
16421642
if :ref:`named placeholders <sqlite3-placeholders>` are used and

Doc/whatsnew/3.14.rst

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,30 @@ Removed
104104
argparse
105105
--------
106106

107-
* The *type*, *choices*, and *metavar* parameters
108-
of :class:`!argparse.BooleanOptionalAction` are removed.
107+
* Remove the *type*, *choices*, and *metavar* parameters
108+
of :class:`!argparse.BooleanOptionalAction`.
109109
They were deprecated since 3.12.
110110

111+
collections.abc
112+
---------------
113+
114+
* Remove :class:`!collections.abc.ByteString`. It had previously raised a
115+
:exc:`DeprecationWarning` since Python 3.12.
116+
117+
111118
email
112119
-----
113120

114-
* The *isdst* parameter has been removed from :func:`email.utils.localtime`.
121+
* Remove the *isdst* parameter from :func:`email.utils.localtime`.
115122
(Contributed by Hugo van Kemenade in :gh:`118798`.)
116123

124+
itertools
125+
---------
126+
127+
* Remove :mod:`itertools` support for copy, deepcopy, and pickle operations.
128+
These had previously raised a :exc:`DeprecationWarning` since Python 3.12.
129+
(Contributed by Raymond Hettinger in :gh:`101588`.)
130+
117131
pathlib
118132
-------
119133

@@ -122,21 +136,25 @@ pathlib
122136
:meth:`~pathlib.PurePath.is_relative_to`. In previous versions, any such
123137
arguments are joined onto *other*.
124138

139+
sqlite3
140+
-------
141+
142+
* Remove :data:`!version` and :data:`!version_info` from :mod:`sqlite3`.
143+
(Contributed by Hugo van Kemenade in :gh:`118924`.)
144+
145+
typing
146+
------
147+
148+
* Remove :class:`!typing.ByteString`. It had previously raised a
149+
:exc:`DeprecationWarning` since Python 3.12.
150+
125151
Others
126152
------
127153

128154
* Using :data:`NotImplemented` in a boolean context will now raise a :exc:`TypeError`.
129155
It had previously raised a :exc:`DeprecationWarning` since Python 3.9. (Contributed
130156
by Jelle Zijlstra in :gh:`118767`.)
131157

132-
* :class:`!typing.ByteString` and :class:`!collections.abc.ByteString`
133-
are removed. They had previously raised a :exc:`DeprecationWarning`
134-
since Python 3.12.
135-
136-
* :mod:`itertools` support for copy, deepcopy, and pickle operations.
137-
These had previously raised a :exc:`DeprecationWarning` since Python 3.12.
138-
(Contributed by Raymond Hettinger in :gh:`101588`.)
139-
140158

141159
Porting to Python 3.14
142160
======================

Lib/sqlite3/__init__.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,3 @@
5555
"""
5656

5757
from sqlite3.dbapi2 import *
58-
from sqlite3.dbapi2 import (_deprecated_names,
59-
_deprecated_version_info,
60-
_deprecated_version)
61-
62-
63-
def __getattr__(name):
64-
if name in _deprecated_names:
65-
from warnings import warn
66-
67-
warn(f"{name} is deprecated and will be removed in Python 3.14",
68-
DeprecationWarning, stacklevel=2)
69-
return globals()[f"_deprecated_{name}"]
70-
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

Lib/sqlite3/dbapi2.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
import collections.abc
2626

2727
from _sqlite3 import *
28-
from _sqlite3 import _deprecated_version
29-
30-
_deprecated_names = frozenset({"version", "version_info"})
3128

3229
paramstyle = "qmark"
3330

@@ -48,7 +45,7 @@ def TimeFromTicks(ticks):
4845
def TimestampFromTicks(ticks):
4946
return Timestamp(*time.localtime(ticks)[:6])
5047

51-
_deprecated_version_info = tuple(map(int, _deprecated_version.split(".")))
48+
5249
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
5350

5451
Binary = memoryview
@@ -97,12 +94,3 @@ def convert_timestamp(val):
9794
# Clean up namespace
9895

9996
del(register_adapters_and_converters)
100-
101-
def __getattr__(name):
102-
if name in _deprecated_names:
103-
from warnings import warn
104-
105-
warn(f"{name} is deprecated and will be removed in Python 3.14",
106-
DeprecationWarning, stacklevel=2)
107-
return globals()[f"_deprecated_{name}"]
108-
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,6 @@ def test_api_level(self):
4848
self.assertEqual(sqlite.apilevel, "2.0",
4949
"apilevel is %s, should be 2.0" % sqlite.apilevel)
5050

51-
def test_deprecated_version(self):
52-
msg = "deprecated and will be removed in Python 3.14"
53-
for attr in "version", "version_info":
54-
with self.subTest(attr=attr):
55-
with self.assertWarnsRegex(DeprecationWarning, msg) as cm:
56-
getattr(sqlite, attr)
57-
self.assertEqual(cm.filename, __file__)
58-
with self.assertWarnsRegex(DeprecationWarning, msg) as cm:
59-
getattr(sqlite.dbapi2, attr)
60-
self.assertEqual(cm.filename, __file__)
61-
6251
def test_thread_safety(self):
6352
self.assertIn(sqlite.threadsafety, {0, 1, 3},
6453
"threadsafety is %d, should be 0, 1 or 3" %

Misc/NEWS.d/3.12.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,7 @@ Illia Volochii.
34983498
.. nonce: tjfu9L
34993499
.. section: Library
35003500
3501-
Deprecate :data:`sqlite3.version` and :data:`sqlite3.version_info`.
3501+
Deprecate :data:`!version` and :data:`!version_info`.
35023502

35033503
..
35043504
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove :data:`!version` and :data:`!version_info` from :mod:`sqlite3`.
2+
Patch by Hugo van Kemenade.

Modules/_sqlite/module.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,6 @@ module_exec(PyObject *module)
714714
goto error;
715715
}
716716

717-
if (PyModule_AddStringConstant(module, "_deprecated_version", PYSQLITE_VERSION) < 0) {
718-
goto error;
719-
}
720-
721717
if (PyModule_AddStringConstant(module, "sqlite_version", sqlite3_libversion())) {
722718
goto error;
723719
}

0 commit comments

Comments
 (0)