Repository navigation
Python3.11: sqlite3.connect passes more arguments to factory() #95132
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 22, 2022 - added3.11only security fixesonly security fixes3.12only security fixesonly security fixes
on Jul 22, 2022 - addedtriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.
on Jul 22, 2022 Thanks for the report. This is unfortunate. Reverting the offending commit is going to be hairy; there has been a lot of changes since that point in time.
The only thing
sqlite3.connectneeds in order to relay the call tosqlite3.Connection.__init__is:*args,**kwargs, andfactory. Unfortunately, doing such a manoeuvre is impossible (AFAIK) with Argument Clinic. Trying to bend AC to our needs, could be an option. Another option is to just parse thefactoryargument manually (kinda like the old code), and pass the rest using vector call (orPyObject_Call). I've already tried to look for a way to do these things because of keyword-only argument needs in another PR (#93823); I might actually be able to adopt that approach.@serhiy-storchaka, do you have an opinion here?
Thanks again for testing the 3.11 beta! Reports like this help us improve.
I've already tried to look for a way to do these things because of keyword-only argument needs in another PR (#93823); I might actually be able to adopt that approach.
FTR, this won't work. Arguments will still be passed incorrectly.
- added a commit that references this issue
on Jul 22, 2022 - added a commit that references this issue
on Jul 22, 2022 I've updated #95146 to use
METH_FASTCALLandPyObject_Vectorcall.- added a commit that references this issue
on Jul 23, 2022 Nice fix.
Reacted by Erlend E. Aasland
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Hello,
Bug report
Consider the following code snippet:
$ cat /tmp/test.py
And the execution:
The default values of sqlite3.connect's arguments are passed to the factory in
Python3.11, which was not the case in Python3.10. This means that code like
this will fail:
$ cat /tmp/failure.py
Your environment
This behaviour appeared in 185ecdc and affects
Python 3.11 and later.
It was mentioned in #93044 (see the
second bullet point in the reporter's message) but has not been fixed.