Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-93370 : Deprecate sqlite3.version and sqlite3.version_info#93482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
erlend-aasland merged 29 commits intopython:mainfromrawwar:fix-issue-93370
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
29 commits
Select commitHold shift + click to select a range
5debfa5
remove version and version_info from sqlite3
rawwarJun 3, 2022
c648144
Merge branch 'python:main' into fix-issue-93370
rawwarJun 3, 2022
ee0cec7
📜🤖 Added by blurb_it.
blurb-it[bot]Jun 3, 2022
69e7410
used __getattr__ to raise warnings
rawwarJun 3, 2022
6c2a8c8
removed repeated declaration
rawwarJun 3, 2022
459a94c
including feedback
rawwarJun 4, 2022
4a55ef3
move declaration to the start of the module
rawwarJun 4, 2022
1a75e5f
fixed formatting issues
rawwarJun 4, 2022
8584a03
extra lines removed
rawwarJun 4, 2022
fa80dd6
Update Lib/sqlite3/__init__.py
rawwarJun 4, 2022
f47ddf3
Update Lib/sqlite3/dbapi2.py
rawwarJun 4, 2022
f033aea
Update Lib/sqlite3/dbapi2.py
rawwarJun 4, 2022
49ea9e1
updated docs
rawwarJun 4, 2022
451e9ef
Update Lib/sqlite3/__init__.py
rawwarJun 4, 2022
591f2b9
Update Lib/sqlite3/dbapi2.py
rawwarJun 4, 2022
3f4e967
Apply suggestions from code review
rawwarJun 4, 2022
d70b247
update blurb with correct ref
rawwarJun 4, 2022
ed50588
included my name in ACKS
rawwarJun 4, 2022
8f06e31
Update Doc/library/sqlite3.rst
rawwarJun 4, 2022
836cddf
adding tests for version and version_info deprec
rawwarJun 4, 2022
2102bf0
added dbapi2 tests and updated docs
rawwarJun 4, 2022
04dad03
use mod sqlite3 in sqlite3 doc
rawwarJun 4, 2022
81cf7fa
Update Doc/library/sqlite3.rst
erlend-aaslandJun 5, 2022
964cf86
Update Doc/library/sqlite3.rst
erlend-aaslandJun 5, 2022
f00b352
added assertIn and assertEqual in tests
rawwarJun 7, 2022
1920746
using assertEqual
rawwarJun 7, 2022
46922f6
removed white space
rawwarJun 7, 2022
45478cc
Apply suggestions from code review
rawwarJun 7, 2022
bc7b463
Update Lib/test/test_sqlite3/test_dbapi.py
erlend-aaslandJun 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletionsDoc/library/sqlite3.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,12 +142,22 @@ 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
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

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
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

Expand Down
13 changes: 13 additions & 0 deletionsLib/sqlite3/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,3 +55,16 @@
"""

fromsqlite3.dbapi2import*
fromsqlite3.dbapi2import (_deprecated_names,
_deprecated_version_info,
_deprecated_version)


def__getattr__(name):
ifnamein_deprecated_names:
fromwarningsimportwarn

warn(f"{name} is deprecated and will be removed in Python 3.14",
DeprecationWarning,stacklevel=2)
returnglobals()[f"_deprecated_{name}"]
raiseAttributeError(f"module{__name__!r} has no attribute{name!r}")
14 changes: 13 additions & 1 deletionLib/sqlite3/dbapi2.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,9 @@
importcollections.abc

from_sqlite3import*
from_sqlite3import_deprecated_version

_deprecated_names=frozenset({"version","version_info"})

paramstyle="qmark"

Expand All@@ -45,7 +48,7 @@ def TimeFromTicks(ticks):
defTimestampFromTicks(ticks):
returnTimestamp(*time.localtime(ticks)[:6])

version_info=tuple([int(x)forxinversion.split(".")])
_deprecated_version_info=tuple(map(int,_deprecated_version.split(".")))
sqlite_version_info=tuple([int(x)forxinsqlite_version.split(".")])

Binary=memoryview
Expand DownExpand Up@@ -85,3 +88,12 @@ def convert_timestamp(val):
# Clean up namespace

del(register_adapters_and_converters)

def__getattr__(name):
ifnamein_deprecated_names:
fromwarningsimportwarn

warn(f"{name} is deprecated and will be removed in Python 3.14",
DeprecationWarning,stacklevel=2)
returnglobals()[f"_deprecated_{name}"]
raiseAttributeError(f"module{__name__!r} has no attribute{name!r}")
11 changes: 11 additions & 0 deletionsLib/test/test_sqlite3/test_dbapi.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,6 +57,17 @@ 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" %
Expand Down
1 change: 1 addition & 0 deletionsMisc/ACKS
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1455,6 +1455,7 @@ Edward K. Ream
Chris Rebert
Marc Recht
John Redford
Kalyan Reddy
Terry J. Reedy
Gareth Rees
John Reese
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
Deprecate :data:`sqlite3.version` and :data:`sqlite3.version_info`.
2 changes: 1 addition & 1 deletionModules/_sqlite/module.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -707,7 +707,7 @@ module_exec(PyObject *module)
gotoerror;
}

if (PyModule_AddStringConstant(module,"version",PYSQLITE_VERSION)<0) {
if (PyModule_AddStringConstant(module,"_deprecated_version",PYSQLITE_VERSION)<0) {
gotoerror;
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp