Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3: remove features deprecated in 3.10 #92547

Closed
erlend-aasland opened this issue May 9, 2022 · 5 comments · Fixed by #92548
Closed

sqlite3: remove features deprecated in 3.10 #92547

erlend-aasland opened this issue May 9, 2022 · 5 comments · Fixed by #92548
Labels

Comments

@erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented May 9, 2022

The following sqlite3 features were deprecated in Python 3.10, and are scheduled for removal in Python 3.12:

  • sqlite3.OptimizedUnicode: #23163
  • sqlite3.enable_shared_cache: #24008

3.12 development was just opened, so these features can now be removed.

@erlend-aasland erlend-aasland added extension-modules easy labels May 9, 2022
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 9, 2022
The following sqlite3 features were deprecated in 3.10, scheduled for
removal in 3.12:

- sqlite3.OptimizedUnicode (pythongh-23163)
- sqlite3.enable_shared_cache (pythongh-24008)

Signed-off-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
@JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented May 9, 2022

Could you check whether any major open-source repos use these (using @vstinner's scripts)? If so, it's going to be better to fix the third-party dependencies first.

@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented May 9, 2022

Certainly!

@vstinner
Copy link
Member

@vstinner vstinner commented May 9, 2022

Results of ./search_pypi_top.py PYPI-2022-01-26-TOP-5000 'OptimizedUnicode|enable_shared_cache' -o sqlite -q if I ignore all .pyi files (type annotation):

nltk-3.6.7.zip: nltk-3.6.7/nltk/sem/relextract.py: connection.text_factory = sqlite3.OptimizedUnicode

pylint-2.12.2.tar.gz: pylint-2.12.2/pylint/checkers/stdlib.py: "sqlite3.OptimizedUnicode",
pylint-2.12.2.tar.gz: pylint-2.12.2/pylint/checkers/stdlib.py: "_sqlite3.enable_shared_cache",

peewee-3.14.8.tar.gz: peewee-3.14.8/playhouse/_pysqlite/connection.h: * - OptimizedUnicode:      Like before, but for ASCII data, only PyStrings are created.
peewee-3.14.8.tar.gz: peewee-3.14.8/playhouse/_pysqlite/module.h: extern PyObject* pysqlite_OptimizedUnicode;

pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyObject*
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: rc = sqlite3_enable_shared_cache(do_enable);
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: PyDoc_STRVAR(module_enable_shared_cache_doc,
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: "enable_shared_cache(do_enable)\n\
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: {"enable_shared_cache",  (PyCFunction)(void(*)(void))module_enable_shared_cache,
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: METH_VARARGS | METH_KEYWORDS, module_enable_shared_cache_doc},
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: OptimizedUnicode caused Unicode objects to be returned for
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: Now OptimizedUnicode is an alias for str, so it has no
pysqlite3-0.4.6.tar.gz: pysqlite3-0.4.6/src/module.c: PyDict_SetItemString(dict, "OptimizedUnicode", (PyObject*)&PyUnicode_Type);

nltk seems to be impacted by the removal of sqlite3.OptimizedUnicode:
https://github.com/nltk/nltk/blob/de46911d9ca248c2c6ce95518cd25e3c277208d7/nltk/sem/relextract.py#L322

@vstinner
Copy link
Member

@vstinner vstinner commented May 9, 2022

pylint-2.12.2/pylint/checkers/stdlib.py is a list of the deprecated functions:
https://github.com/PyCQA/pylint/blob/afa6853b57c8c14970e460ca2651d4157751ad1d/pylint/checkers/stdlib.py#L164

JelleZijlstra added a commit to JelleZijlstra/nltk that referenced this issue May 10, 2022
`OptimizedUnicode` has been an alias for `str` since Python 3.2 and is scheduled for removal in Python 3.12. The default factory is already `str`, so the line wasn't doing anything.

See python/cpython#92547.
erlend-aasland added a commit that referenced this issue May 16, 2022
The following sqlite3 features were deprecated in 3.10, scheduled for
removal in 3.12:

- sqlite3.OptimizedUnicode (gh-23163)
- sqlite3.enable_shared_cache (gh-24008)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Signed-off-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented May 16, 2022

Resolved by #92548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants