FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-93057: Deprecate positional use of optional sqlite3.connect() params by erlend-aasland · Pull Request #107948 · python/cpython · GitHub

/ cpython Public

gh-93057: Deprecate positional use of optional sqlite3.connect() params - #107948

Merged
erlend-aasland merged 8 commits into
python:mainfrom
erlend-aasland:sqlite/deprecate-optional-parameters
Aug 15, 2023
Merged

gh-93057: Deprecate positional use of optional sqlite3.connect() params#107948
erlend-aasland merged 8 commits into
python:mainfrom
erlend-aasland:sqlite/deprecate-optional-parameters

Conversation

erlend-aasland commented Aug 14, 2023
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

This comment was marked as outdated.

Comment thread Doc/whatsnew/3.13.rst Outdated
Comment thread Doc/whatsnew/3.13.rst Outdated

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There is an issue here. Positional parameters are only deprecated in the Connection constructor. But we want also to deprecate them in connect(). Currently you can bypass the deprecations if use the Connection subclass:

class MyConnection(Connection):
    def __init__(self, database, timeout=5.0, ...):
        super().__init__(database, timeout=timeout, ...)

connect(":memory:", 10.0, ..., factory=MyConnection)

But if we add the second deprecation warning in connect(), we will get two deprecation warning.

Copy link
Copy Markdown
Contributor Author

There is an issue here. Positional parameters are only deprecated in the Connection constructor. But we want also to deprecate them in connect(). Currently you can bypass the deprecations if use the Connection subclass:

Ah, of course. That's tricky.

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please add a test for connect() and mention this change in What's New and NEWS entries.

It is a wart that we will get two warnings, but there is no simple way to avoid it, except applying deprecations one at a time -- first in connect(), then (since 3.15) in Connection. Not sure if it it is worth.

We can also convert all positional arguments in connect() into keyword arguments for factory. It is a lot of complex code.

Comment thread Lib/test/test_sqlite3/test_factory.py Outdated

Copy link
Copy Markdown
Contributor Author

We can also convert all positional arguments in connect() into keyword arguments for factory. It is a lot of complex code.

No, that is a backwards incompatible change.

Copy link
Copy Markdown
Contributor Author

mention this change in What's New and NEWS entries.

Is the existing NEWS and What's New entries insufficient? In what way?

Copy link
Copy Markdown
Member

Is the existing NEWS and What's New entries insufficient? In what way?

Ah, they already mention connect()! Then simply add "and the Connection constructor".

Copy link
Copy Markdown
Contributor Author

Is the existing NEWS and What's New entries insufficient? In what way?

Ah, they already mention connect()! Then simply add "and the Connection constructor".

Yeah, that's useful information. I'll add that; thanks.

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.

Copy link
Copy Markdown
Contributor Author

Thanks for the review, Serhiy. Much appreciated.

erlend-aasland enabled auto-merge (squash) August 15, 2023 07:40
erlend-aasland merged commit 13c36dc into python:main Aug 15, 2023
erlend-aasland deleted the sqlite/deprecate-optional-parameters branch August 15, 2023 08:13

erlend-aasland commented Aug 15, 2023
edited
Loading

Copy link
Copy Markdown
Contributor Author

@felixxm, sorry, I forgot to ping you; I hope not these deprecations will create havoc for Django.

felixxm commented Aug 15, 2023

Copy link
Copy Markdown
Contributor

@felixxm, sorry, I forgot to ping you; I hope not these deprecations will create havoc for Django.

All good, Django doesn't pass these positional params, only a database name. Thanks 👍

iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Aug 16, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL