From 5debfa5c476866fb9b6720e68628e64fec4f0232 Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 03:23:41 +0530 Subject: [PATCH 01/28] remove version and version_info from sqlite3 --- Lib/sqlite3/dbapi2.py | 1 - Modules/_sqlite/module.c | 4 ---- Modules/_sqlite/module.h | 1 - 3 files changed, 6 deletions(-) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index 36ce769d5c6b3e..856b950f1f561b 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -45,7 +45,6 @@ def TimeFromTicks(ticks): def TimestampFromTicks(ticks): return Timestamp(*time.localtime(ticks)[:6]) -version_info = tuple([int(x) for x in version.split(".")]) sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")]) Binary = memoryview diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 9b0e921511c56a..a5fa8bcbf47b22 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -707,10 +707,6 @@ module_exec(PyObject *module) goto error; } - if (PyModule_AddStringConstant(module, "version", PYSQLITE_VERSION) < 0) { - goto error; - } - if (PyModule_AddStringConstant(module, "sqlite_version", sqlite3_libversion())) { goto error; } diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h index 7deba22ffec1b6..55fdaa6bc2040a 100644 --- a/Modules/_sqlite/module.h +++ b/Modules/_sqlite/module.h @@ -26,7 +26,6 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" -#define PYSQLITE_VERSION "2.6.0" #define MODULE_NAME "sqlite3" typedef struct { From ee0cec7e6dc569616b306fcc5f413a9a8d0289fb Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 22:13:28 +0000 Subject: [PATCH 02/28] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst diff --git a/Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst b/Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst new file mode 100644 index 00000000000000..495c079ffe6ced --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst @@ -0,0 +1 @@ +deprecate sqlite3.version and sqlite3.version_info. From 69e7410d085336c44245b27a5cb6b1fe14c2ec8b Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 05:08:14 +0530 Subject: [PATCH 03/28] used __getattr__ to raise warnings --- Lib/sqlite3/__init__.py | 10 ++++++++++ Lib/sqlite3/dbapi2.py | 10 ++++++++++ Modules/_sqlite/module.c | 4 ++++ Modules/_sqlite/module.h | 1 + 4 files changed, 25 insertions(+) diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 34a9c047dd607c..21f55929afe259 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -55,3 +55,13 @@ """ from sqlite3.dbapi2 import * +from sqlite3.dbapi2 import _deprecated_version_info, _deprecated_version +from warnings import warn + +deprecated_names = ["version", "version_info"] + +def __getattr__(name): + if name in deprecated_names: + warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) + return globals()[f"_deprecated_{name}"] + raise AttributeError(f"module {__name__} has no attribute {name}") diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index 856b950f1f561b..b69828f8c4c6e7 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -25,7 +25,10 @@ import collections.abc from _sqlite3 import * +from _sqlite3 import _deprecated_version +from warnings import warn +deprecated_names = ["version", "version_info"] paramstyle = "qmark" apilevel = "2.0" @@ -45,6 +48,7 @@ def TimeFromTicks(ticks): def TimestampFromTicks(ticks): return Timestamp(*time.localtime(ticks)[:6]) +_deprecated_version_info = tuple([int(x) for x in _deprecated_version.split(".")]) sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")]) Binary = memoryview @@ -84,3 +88,9 @@ def convert_timestamp(val): # Clean up namespace del(register_adapters_and_converters) + +def __getattr__(name): + if name in deprecated_names: + warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) + return globals()[f"_deprecated_{name}"] + raise AttributeError(f"module {__name__} has no attribute {name}") diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index a5fa8bcbf47b22..995d0946d9414c 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -707,6 +707,10 @@ 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; } diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h index 55fdaa6bc2040a..7deba22ffec1b6 100644 --- a/Modules/_sqlite/module.h +++ b/Modules/_sqlite/module.h @@ -26,6 +26,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" +#define PYSQLITE_VERSION "2.6.0" #define MODULE_NAME "sqlite3" typedef struct { From 6c2a8c8cdd42a1f24b7b8295e07c4fa19b159aab Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 05:11:10 +0530 Subject: [PATCH 04/28] removed repeated declaration --- Lib/sqlite3/__init__.py | 2 -- Lib/sqlite3/dbapi2.py | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 21f55929afe259..8d5cac73274055 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -58,8 +58,6 @@ from sqlite3.dbapi2 import _deprecated_version_info, _deprecated_version from warnings import warn -deprecated_names = ["version", "version_info"] - def __getattr__(name): if name in deprecated_names: warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index b69828f8c4c6e7..8789f08c4f7465 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -28,7 +28,6 @@ from _sqlite3 import _deprecated_version from warnings import warn -deprecated_names = ["version", "version_info"] paramstyle = "qmark" apilevel = "2.0" @@ -89,6 +88,8 @@ def convert_timestamp(val): del(register_adapters_and_converters) +deprecated_names = ["version", "version_info"] + def __getattr__(name): if name in deprecated_names: warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) From 459a94ca8ecaa8c40509b7493b03f79618461860 Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 05:41:28 +0530 Subject: [PATCH 05/28] including feedback --- Lib/sqlite3/__init__.py | 11 +++++++---- Lib/sqlite3/dbapi2.py | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 8d5cac73274055..003bb98e763dc5 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -55,11 +55,14 @@ """ from sqlite3.dbapi2 import * -from sqlite3.dbapi2 import _deprecated_version_info, _deprecated_version -from warnings import warn +from sqlite3.dbapi2 import ( _deprecated_names, + _deprecated_version_info, + _deprecated_version) def __getattr__(name): - if name in deprecated_names: + + if name in _deprecated_names: + from warnings import warn warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) return globals()[f"_deprecated_{name}"] - raise AttributeError(f"module {__name__} has no attribute {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 8789f08c4f7465..a8825423c88c67 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -26,7 +26,6 @@ from _sqlite3 import * from _sqlite3 import _deprecated_version -from warnings import warn paramstyle = "qmark" @@ -88,10 +87,11 @@ def convert_timestamp(val): del(register_adapters_and_converters) -deprecated_names = ["version", "version_info"] +_deprecated_names = ["version", "version_info"] def __getattr__(name): - if name in deprecated_names: + if name in _deprecated_names: + from warnings import warn warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) return globals()[f"_deprecated_{name}"] - raise AttributeError(f"module {__name__} has no attribute {name}") + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") From 4a55ef3a30e86805db197b598ee0a7635cb05adf Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 05:43:31 +0530 Subject: [PATCH 06/28] move declaration to the start of the module --- Lib/sqlite3/__init__.py | 1 - Lib/sqlite3/dbapi2.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 003bb98e763dc5..c383fc0de4df83 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -60,7 +60,6 @@ _deprecated_version) def __getattr__(name): - if name in _deprecated_names: from warnings import warn warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index a8825423c88c67..6a923d5df1b5e3 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -27,6 +27,8 @@ from _sqlite3 import * from _sqlite3 import _deprecated_version +_deprecated_names = ["version", "version_info"] + paramstyle = "qmark" apilevel = "2.0" @@ -87,7 +89,6 @@ def convert_timestamp(val): del(register_adapters_and_converters) -_deprecated_names = ["version", "version_info"] def __getattr__(name): if name in _deprecated_names: From 1a75e5f18cdcdce94abe690ff3a009155646fa8f Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 05:54:39 +0530 Subject: [PATCH 07/28] fixed formatting issues --- Lib/sqlite3/__init__.py | 8 +++++--- Lib/sqlite3/dbapi2.py | 13 ++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index c383fc0de4df83..45008c290d96ea 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -55,13 +55,15 @@ """ from sqlite3.dbapi2 import * -from sqlite3.dbapi2 import ( _deprecated_names, - _deprecated_version_info, +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. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) + warn(f"{name} is deprecated. 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 6a923d5df1b5e3..fd9cde2f3d8e84 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -39,21 +39,27 @@ Timestamp = datetime.datetime + def DateFromTicks(ticks): return Date(*time.localtime(ticks)[:3]) + def TimeFromTicks(ticks): return Time(*time.localtime(ticks)[3:6]) + def TimestampFromTicks(ticks): return Timestamp(*time.localtime(ticks)[:6]) -_deprecated_version_info = tuple([int(x) for x in _deprecated_version.split(".")]) + +_deprecated_version_info = tuple( + [int(x) for x in _deprecated_version.split(".")]) sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")]) Binary = memoryview collections.abc.Sequence.register(Row) + def register_adapters_and_converters(): def adapt_date(val): return val.isoformat() @@ -77,12 +83,12 @@ def convert_timestamp(val): val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds) return val - register_adapter(datetime.date, adapt_date) register_adapter(datetime.datetime, adapt_datetime) register_converter("date", convert_date) register_converter("timestamp", convert_timestamp) + register_adapters_and_converters() # Clean up namespace @@ -93,6 +99,7 @@ def convert_timestamp(val): def __getattr__(name): if name in _deprecated_names: from warnings import warn - warn(f"{name} is deprecated. Will be removed in python 3.14", DeprecationWarning, stacklevel=2) + warn(f"{name} is deprecated. 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}") From 8584a031c8a2c9cf46ec7a56b4c1856cf54b6db4 Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 05:57:14 +0530 Subject: [PATCH 08/28] extra lines removed --- Lib/sqlite3/dbapi2.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index fd9cde2f3d8e84..948be448380dad 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -39,19 +39,15 @@ Timestamp = datetime.datetime - def DateFromTicks(ticks): return Date(*time.localtime(ticks)[:3]) - def TimeFromTicks(ticks): return Time(*time.localtime(ticks)[3:6]) - def TimestampFromTicks(ticks): return Timestamp(*time.localtime(ticks)[:6]) - _deprecated_version_info = tuple( [int(x) for x in _deprecated_version.split(".")]) sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")]) @@ -83,19 +79,18 @@ def convert_timestamp(val): val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds) return val + register_adapter(datetime.date, adapt_date) register_adapter(datetime.datetime, adapt_datetime) register_converter("date", convert_date) register_converter("timestamp", convert_timestamp) - register_adapters_and_converters() # Clean up namespace del(register_adapters_and_converters) - def __getattr__(name): if name in _deprecated_names: from warnings import warn From fa80dd62d6ad1c125778dc19d00f7f8c2f86cc88 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 4 Jun 2022 16:35:23 +0530 Subject: [PATCH 09/28] Update Lib/sqlite3/__init__.py Co-authored-by: Alex Waygood --- Lib/sqlite3/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 45008c290d96ea..330045a1f4c636 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -63,7 +63,7 @@ def __getattr__(name): if name in _deprecated_names: from warnings import warn - warn(f"{name} is deprecated. Will be removed in python 3.14", + 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}") From f47ddf3eee66c3fc8c05f169f08ca67a1ef29dfb Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 4 Jun 2022 16:35:28 +0530 Subject: [PATCH 10/28] Update Lib/sqlite3/dbapi2.py Co-authored-by: Alex Waygood --- Lib/sqlite3/dbapi2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index 948be448380dad..1c063c022c6d6a 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -55,7 +55,6 @@ def TimestampFromTicks(ticks): Binary = memoryview collections.abc.Sequence.register(Row) - def register_adapters_and_converters(): def adapt_date(val): return val.isoformat() From f033aea39e520df7a832e6e18ef9999aac15480c Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 4 Jun 2022 16:35:34 +0530 Subject: [PATCH 11/28] Update Lib/sqlite3/dbapi2.py Co-authored-by: Alex Waygood --- Lib/sqlite3/dbapi2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index 1c063c022c6d6a..0c81eb0cccc138 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -93,7 +93,7 @@ def convert_timestamp(val): def __getattr__(name): if name in _deprecated_names: from warnings import warn - warn(f"{name} is deprecated. Will be removed in python 3.14", + 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}") From 49ea9e1f2175f98075c9b21f3a75347ab453f921 Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 21:48:17 +0530 Subject: [PATCH 12/28] updated docs --- Doc/library/sqlite3.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 1843e22640f014..19aca62241d7dc 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -142,11 +142,15 @@ Module functions and constants The version number of this module, as a string. This is not the version of the SQLite library. + .. deprecated-removed:: 3.12 3.14 + .. data:: version_info The version number of this module, as a tuple of integers. This is not the version of the SQLite library. + + .. deprecated-removed:: 3.12 3.14 .. data:: sqlite_version From 451e9ef8e439881edb6fea8a28925f81a6dd2a44 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 4 Jun 2022 22:09:24 +0530 Subject: [PATCH 13/28] Update Lib/sqlite3/__init__.py Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Lib/sqlite3/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 330045a1f4c636..927267cf0b92ff 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -63,6 +63,7 @@ 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}"] From 591f2b93aed6a8757bcc63eae84b777941617ec0 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 4 Jun 2022 22:09:37 +0530 Subject: [PATCH 14/28] Update Lib/sqlite3/dbapi2.py Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Lib/sqlite3/dbapi2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index 0c81eb0cccc138..33583305da3e5b 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -27,7 +27,7 @@ from _sqlite3 import * from _sqlite3 import _deprecated_version -_deprecated_names = ["version", "version_info"] +_deprecated_names = frozenset({"version", "version_info"}) paramstyle = "qmark" From 3f4e9671a5301d1817a8b07e1b4cf794969c6a48 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 4 Jun 2022 22:10:24 +0530 Subject: [PATCH 15/28] Apply suggestions from code review Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Lib/sqlite3/dbapi2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py index 33583305da3e5b..3b6d2f7ba2d595 100644 --- a/Lib/sqlite3/dbapi2.py +++ b/Lib/sqlite3/dbapi2.py @@ -48,8 +48,7 @@ def TimeFromTicks(ticks): def TimestampFromTicks(ticks): return Timestamp(*time.localtime(ticks)[:6]) -_deprecated_version_info = tuple( - [int(x) for x in _deprecated_version.split(".")]) +_deprecated_version_info = tuple(map(int, _deprecated_version.split("."))) sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")]) Binary = memoryview @@ -93,6 +92,7 @@ def convert_timestamp(val): 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}"] From d70b24707abc8fce6cd32da777c560f1dd3dc9ed Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 22:28:23 +0530 Subject: [PATCH 16/28] update blurb with correct ref --- .../next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst b/Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst index 495c079ffe6ced..bd531503800319 100644 --- a/Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst +++ b/Misc/NEWS.d/next/Library/2022-06-03-22-13-28.gh-issue-93370.tjfu9L.rst @@ -1 +1 @@ -deprecate sqlite3.version and sqlite3.version_info. +Deprecate :data:`sqlite3.version` and :data:`sqlite3.version_info`. From ed5058888eb67ebc8a447b6273a425d1e80191ab Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 22:30:46 +0530 Subject: [PATCH 17/28] included my name in ACKS --- Misc/ACKS | 1 + 1 file changed, 1 insertion(+) diff --git a/Misc/ACKS b/Misc/ACKS index d0e18303434f22..a818c3dcd770bb 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1455,6 +1455,7 @@ Edward K. Ream Chris Rebert Marc Recht John Redford +Kalyan Reddy Terry J. Reedy Gareth Rees John Reese From 8f06e312492b7dae1e5376272811a728f5c3ec1a Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 4 Jun 2022 23:00:53 +0530 Subject: [PATCH 18/28] Update Doc/library/sqlite3.rst Co-authored-by: Alex Waygood --- Doc/library/sqlite3.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 19aca62241d7dc..ca45356425f7d8 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -149,7 +149,7 @@ Module functions and constants The version number of this module, as a tuple of integers. This is not the version of the SQLite library. - + .. deprecated-removed:: 3.12 3.14 From 836cddf67a4342ef48605c9954c8c9f68806c989 Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 23:11:34 +0530 Subject: [PATCH 19/28] adding tests for version and version_info deprec --- 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 1fa02db3b3af41..b88700c3dc2148 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -57,6 +57,14 @@ def test_api_level(self): self.assertEqual(sqlite.apilevel, "2.0", "apilevel is %s, should be 2.0" % sqlite.apilevel) + def test_version(self): + with self.assertWarns(DeprecationWarning): + sqlite.version + + def test_version_info(self): + with self.assertWarns(DeprecationWarning): + sqlite.version_info + def test_thread_safety(self): self.assertIn(sqlite.threadsafety, {0, 1, 3}, "threadsafety is %d, should be 0, 1 or 3" % From 2102bf08097fd30bc82473f54a523991eaea210d Mon Sep 17 00:00:00 2001 From: rawwar Date: Sat, 4 Jun 2022 23:59:18 +0530 Subject: [PATCH 20/28] added dbapi2 tests and updated docs --- Doc/library/sqlite3.rst | 6 ++++++ Lib/test/test_sqlite3/test_dbapi.py | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index ca45356425f7d8..5ed041ec25fe27 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -143,6 +143,9 @@ Module functions and constants the SQLite library. .. deprecated-removed:: 3.12 3.14 + It used to reflect the pysqlite version number, until the external + pysqlite package stopped upstreaming changes to the stdlib sqlite3 + module, but today it carries no meaning or practical value. .. data:: version_info @@ -151,6 +154,9 @@ Module functions and constants version of the SQLite library. .. deprecated-removed:: 3.12 3.14 + It used to reflect the pysqlite version number, until the external + pysqlite package stopped upstreaming changes to the stdlib sqlite3 + module, but today it carries no meaning or practical value. .. data:: sqlite_version diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index b88700c3dc2148..a2cffc158504dd 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -65,6 +65,14 @@ def test_version_info(self): with self.assertWarns(DeprecationWarning): sqlite.version_info + def test_dbapi2_version(self): + with self.assertWarns(DeprecationWarning): + sqlite.dbapi2.version + + def test_dbapi2_version_info(self): + with self.assertWarns(DeprecationWarning): + sqlite.dbapi2.version_info + def test_thread_safety(self): self.assertIn(sqlite.threadsafety, {0, 1, 3}, "threadsafety is %d, should be 0, 1 or 3" % From 04dad03f8bb77141322817fe87fc64931a2bfc18 Mon Sep 17 00:00:00 2001 From: rawwar Date: Sun, 5 Jun 2022 00:10:31 +0530 Subject: [PATCH 21/28] use mod sqlite3 in sqlite3 doc --- Doc/library/sqlite3.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 5ed041ec25fe27..031ac10d6a39de 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -143,8 +143,8 @@ Module functions and constants the SQLite library. .. deprecated-removed:: 3.12 3.14 - It used to reflect the pysqlite version number, until the external - pysqlite package stopped upstreaming changes to the stdlib sqlite3 + It used to reflect the ``pysqlite`` version number, until the external + pysqlite package stopped upstreaming changes to the stdlib :mod:`sqlite3` module, but today it carries no meaning or practical value. @@ -154,8 +154,8 @@ Module functions and constants version of the SQLite library. .. deprecated-removed:: 3.12 3.14 - It used to reflect the pysqlite version number, until the external - pysqlite package stopped upstreaming changes to the stdlib sqlite3 + It used to reflect the ``pysqlite`` version number, until the external + pysqlite package stopped upstreaming changes to the stdlib :mod:`sqlite3` module, but today it carries no meaning or practical value. From 81cf7fa51292a52c4a5d32403c68647e954bd151 Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Sun, 5 Jun 2022 15:13:03 +0200 Subject: [PATCH 22/28] Update Doc/library/sqlite3.rst Co-authored-by: Alex Waygood --- Doc/library/sqlite3.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 031ac10d6a39de..8dec1acce33096 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -143,9 +143,9 @@ Module functions and constants the SQLite library. .. deprecated-removed:: 3.12 3.14 - It used to reflect the ``pysqlite`` version number, until the external - pysqlite package stopped upstreaming changes to the stdlib :mod:`sqlite3` - module, but today it carries no meaning or practical value. + This constant used to reflect the version number of the ``pysqlite`` + package, a third-party library which used to upstream changes to + ``sqlite3``. Today, it carries no meaning or practical value. .. data:: version_info From 964cf86275a566a16b2ca5352b12b1ba02f2c3aa Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Sun, 5 Jun 2022 15:16:03 +0200 Subject: [PATCH 23/28] Update Doc/library/sqlite3.rst Co-authored-by: Alex Waygood --- Doc/library/sqlite3.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 8dec1acce33096..3807cdc640cc69 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -154,9 +154,9 @@ Module functions and constants version of the SQLite library. .. deprecated-removed:: 3.12 3.14 - It used to reflect the ``pysqlite`` version number, until the external - pysqlite package stopped upstreaming changes to the stdlib :mod:`sqlite3` - module, but today it carries no meaning or practical value. + This constant used to reflect the version number of the ``pysqlite`` + package, a third-party library which used to upstream changes to + ``sqlite3``. Today, it carries no meaning or practical value. .. data:: sqlite_version From f00b352913bc2b6bea51c25ee86210cbed808d35 Mon Sep 17 00:00:00 2001 From: rawwar Date: Wed, 8 Jun 2022 01:47:03 +0530 Subject: [PATCH 24/28] added assertIn and assertEqual in tests --- Lib/test/test_sqlite3/test_dbapi.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index a2cffc158504dd..1e3a77f4694852 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -58,20 +58,28 @@ def test_api_level(self): "apilevel is %s, should be 2.0" % sqlite.apilevel) def test_version(self): - with self.assertWarns(DeprecationWarning): + with self.assertWarns(DeprecationWarning) as cm: sqlite.version + self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual('version is deprecated and will be removed in Python 3.14', str(cm.warning)) def test_version_info(self): - with self.assertWarns(DeprecationWarning): + with self.assertWarns(DeprecationWarning) as cm: sqlite.version_info + self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual('version_info is deprecated and will be removed in Python 3.14', str(cm.warning)) def test_dbapi2_version(self): - with self.assertWarns(DeprecationWarning): + with self.assertWarns(DeprecationWarning) as cm: sqlite.dbapi2.version + self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual('version is deprecated and will be removed in Python 3.14', str(cm.warning)) def test_dbapi2_version_info(self): - with self.assertWarns(DeprecationWarning): + with self.assertWarns(DeprecationWarning) as cm: sqlite.dbapi2.version_info + self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual('version_info is deprecated and will be removed in Python 3.14', str(cm.warning)) def test_thread_safety(self): self.assertIn(sqlite.threadsafety, {0, 1, 3}, From 1920746cd471ff5ee7285c24a5a68df9af447021 Mon Sep 17 00:00:00 2001 From: rawwar Date: Wed, 8 Jun 2022 01:49:06 +0530 Subject: [PATCH 25/28] using assertEqual --- Lib/test/test_sqlite3/test_dbapi.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 1e3a77f4694852..42dd820d568b2c 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -60,25 +60,25 @@ def test_api_level(self): def test_version(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.version - self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual(cm.filename, __file__) self.assertEqual('version is deprecated and will be removed in Python 3.14', str(cm.warning)) - + def test_version_info(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.version_info - self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual(cm.filename, __file__) self.assertEqual('version_info is deprecated and will be removed in Python 3.14', str(cm.warning)) def test_dbapi2_version(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.dbapi2.version - self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual(cm.filename, __file__) self.assertEqual('version is deprecated and will be removed in Python 3.14', str(cm.warning)) def test_dbapi2_version_info(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.dbapi2.version_info - self.assertIn("test_dbapi.py", cm.filename) + self.assertEqual(cm.filename, __file__) self.assertEqual('version_info is deprecated and will be removed in Python 3.14', str(cm.warning)) def test_thread_safety(self): From 46922f6bf66c22314a75012317a175de3bf00d5b Mon Sep 17 00:00:00 2001 From: rawwar Date: Wed, 8 Jun 2022 02:08:52 +0530 Subject: [PATCH 26/28] removed white space --- Lib/test/test_sqlite3/test_dbapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 42dd820d568b2c..152ed00a0d46ff 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -62,7 +62,7 @@ def test_version(self): sqlite.version self.assertEqual(cm.filename, __file__) self.assertEqual('version is deprecated and will be removed in Python 3.14', str(cm.warning)) - + def test_version_info(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.version_info From 45478ccdd123fc9f6943e9d5f38e0001dd246803 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Wed, 8 Jun 2022 03:01:52 +0530 Subject: [PATCH 27/28] Apply suggestions from code review Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Lib/test/test_sqlite3/test_dbapi.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 152ed00a0d46ff..5734fff9d9400d 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -61,25 +61,29 @@ def test_version(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.version self.assertEqual(cm.filename, __file__) - self.assertEqual('version is deprecated and will be removed in Python 3.14', str(cm.warning)) + self.assertEqual('version is deprecated and will be removed in Python 3.14', + str(cm.warning)) def test_version_info(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.version_info self.assertEqual(cm.filename, __file__) - self.assertEqual('version_info is deprecated and will be removed in Python 3.14', str(cm.warning)) + self.assertEqual('version_info is deprecated and will be removed in Python 3.14', + str(cm.warning)) def test_dbapi2_version(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.dbapi2.version self.assertEqual(cm.filename, __file__) - self.assertEqual('version is deprecated and will be removed in Python 3.14', str(cm.warning)) + self.assertEqual('version is deprecated and will be removed in Python 3.14', + str(cm.warning)) def test_dbapi2_version_info(self): with self.assertWarns(DeprecationWarning) as cm: sqlite.dbapi2.version_info self.assertEqual(cm.filename, __file__) - self.assertEqual('version_info is deprecated and will be removed in Python 3.14', str(cm.warning)) + self.assertEqual('version_info is deprecated and will be removed in Python 3.14', + str(cm.warning)) def test_thread_safety(self): self.assertIn(sqlite.threadsafety, {0, 1, 3}, From bc7b463bfb9824374ec35a26f525df0053fc4be1 Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Wed, 8 Jun 2022 01:03:23 +0200 Subject: [PATCH 28/28] Update Lib/test/test_sqlite3/test_dbapi.py --- Lib/test/test_sqlite3/test_dbapi.py | 37 ++++++++--------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 5734fff9d9400d..b958bf112a9309 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -57,33 +57,16 @@ def test_api_level(self): self.assertEqual(sqlite.apilevel, "2.0", "apilevel is %s, should be 2.0" % sqlite.apilevel) - def test_version(self): - with self.assertWarns(DeprecationWarning) as cm: - sqlite.version - self.assertEqual(cm.filename, __file__) - self.assertEqual('version is deprecated and will be removed in Python 3.14', - str(cm.warning)) - - def test_version_info(self): - with self.assertWarns(DeprecationWarning) as cm: - sqlite.version_info - self.assertEqual(cm.filename, __file__) - self.assertEqual('version_info is deprecated and will be removed in Python 3.14', - str(cm.warning)) - - def test_dbapi2_version(self): - with self.assertWarns(DeprecationWarning) as cm: - sqlite.dbapi2.version - self.assertEqual(cm.filename, __file__) - self.assertEqual('version is deprecated and will be removed in Python 3.14', - str(cm.warning)) - - def test_dbapi2_version_info(self): - with self.assertWarns(DeprecationWarning) as cm: - sqlite.dbapi2.version_info - self.assertEqual(cm.filename, __file__) - self.assertEqual('version_info is deprecated and will be removed in Python 3.14', - str(cm.warning)) + 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},