gh-93057: Deprecate positional use of optional sqlite3.connect() params#107948
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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.
Sorry, something went wrong.
Ah, of course. That's tricky. |
Sorry, something went wrong.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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.
Sorry, something went wrong.
No, that is a backwards incompatible change. |
Sorry, something went wrong.
Is the existing NEWS and What's New entries insufficient? In what way? |
Sorry, something went wrong.
Ah, they already mention connect()! Then simply add "and the Connection constructor". |
Sorry, something went wrong.
Yeah, that's useful information. I'll add that; thanks. |
Sorry, something went wrong.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
|
Thanks for the review, Serhiy. Much appreciated. |
Sorry, something went wrong.
|
@felixxm, sorry, I forgot to ping you; I hope not these deprecations will create havoc for Django. |
Sorry, something went wrong.
All good, Django doesn't pass these positional params, only a database name. Thanks 👍 |
Sorry, something went wrong.
📚 Documentation preview 📚: https://cpython-previews--107948.org.readthedocs.build/