Repository navigation
Use Argument Clinic in sqlite3 #85128
Copy link
Copy link
Closed
Labels
3.10 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2021-06-20.20:29:03.608>
created_at = <Date 2020-06-12.10:05:35.702>
labels = ['type-feature', 'library', '3.10']
title = 'Use Argument Clinic in sqlite3'
updated_at = <Date 2021-06-20.20:29:03.605>
user = 'https://github.com/erlend-aasland'bugs.python.org fields:
activity = <Date 2021-06-20.20:29:03.605>
actor = 'erlendaasland'
assignee = 'none'
closed = True
closed_date = <Date 2021-06-20.20:29:03.608>
closer = 'erlendaasland'
components = ['Library (Lib)']
creation = <Date 2020-06-12.10:05:35.702>
creator = 'erlendaasland'
dependencies = []
files = []
hgrepos = []
issue_num = 40956
keywords = ['patch']
message_count = 24.0
messages = ['371347', '378558', '378560', '378561', '378562', '378571', '380042', '380043', '380047', '383301', '383303', '383841', '384000', '384444', '385012', '385015', '385019', '385036', '385053', '385058', '386814', '396188', '396191', '396197']
nosy_count = 6.0
nosy_names = ['vstinner', 'berker.peksag', 'serhiy.storchaka', 'corona10', 'pablogsal', 'erlendaasland']
pr_nums = ['20826', '22484', '22478', '23057', '23341', '23837', '23838', '23964', '24007', '24135', '24214', '24421', '24503']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue40956'
versions = ['Python 3.10']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Activity
erlend-aasland commentedon Jun 12, 2020
Use Argument Clinic in sqlite3.
corona10 commentedon Oct 13, 2020
What's the purpose of using AC, did the change improve performance?
It can make hard to track the code history.
erlend-aasland commentedon Oct 13, 2020
The primary reason is that it will be provide easy access to module state.
The first step in making sqlite3 support multiphase init was to create heap types. The second step is argument clinic. The third will be to use AC for module state. The last step will then be final multiphase support.
Also, IMHO, AC greatly improves the body of methods (readability => maintainability, hardened parsing of arguments)
erlend-aasland commentedon Oct 13, 2020
Also, see the comment from Victor here: #22478 (comment)
corona10 commentedon Oct 13, 2020
Okay got it
erlend-aasland commentedon Oct 13, 2020
By the way, what's the preferred way to benchmark performance?
corona10 commentedon Oct 31, 2020
New changeset 7d21027 by Erlend Egeberg Aasland in branch 'master':
bpo-40956: Convert _sqlite3 module level functions to Argument Clinic (GH-22484)
7d21027
corona10 commentedon Oct 31, 2020
@erlendaasland
Thank you erlendaasland for working on #66674.
This time was a good time to review my AC knowledge ;)
erlend-aasland commentedon Oct 31, 2020
… and thank you for taking the time to review this!
corona10 commentedon Dec 18, 2020
New changeset 1ba82bb by Erlend Egeberg Aasland in branch 'master':
bpo-40956: Convert _sqlite3.Connection to Argument Clinic (GH-23341)
1ba82bb
corona10 commentedon Dec 18, 2020
New changeset 2179349 by Dong-hee Na in branch 'master':
bpo-40956: Fix sqlite3 AC code (GH-23837)
2179349
corona10 commentedon Dec 27, 2020
New changeset 3ccef1c by Erlend Egeberg Aasland in branch 'master':
bpo-40956: Convert _sqlite3.Connection to Argument Clinic, part 2 (GH-23838)
3ccef1c
serhiy-storchaka commentedon Dec 29, 2020
New changeset 84d79cf by Erlend Egeberg Aasland in branch 'master':
bpo-40956: Convert _sqlite3.Row to Argument Clinic (GH-23964)
84d79cf
berkerpeksag commentedon Jan 5, 2021
New changeset c7f8d3c by Erlend Egeberg Aasland in branch 'master':
bpo-40956: Convert _sqlite3.Cursor to Argument Clinic (GH-24007)
c7f8d3c
erlend-aasland commentedon Jan 13, 2021
#68195 introduced a regression:
erlend-aasland commentedon Jan 13, 2021
Looks like this is the culprit:
cpython/Modules/_sqlite/cursor.c
Line 825 in 2396614
erlend-aasland commentedon Jan 13, 2021
I don't see how to easily solve this in AC: we want the arraysize of the cursor instance, but I don't see how I'm going to get this via the AC namespace/context. Using a "bogus" default value works:
size as maxrows: int(c_default='self->arraysize') = 1
Is there a better way?
serhiy-storchaka commentedon Jan 13, 2021
Use NULL.
erlend-aasland commentedon Jan 13, 2021
Thanks, but I prefer the following:
size as maxrows: int(c_default='self->arraysize', py_default='<unrepresentable>') = 1
berkerpeksag commentedon Jan 13, 2021
New changeset a330365 by Erlend Egeberg Aasland in branch 'master':
bpo-40956: Fix sqlite3.Cursor.fetchmany() default value (GH-24214)
a330365
berkerpeksag commentedon Feb 10, 2021
New changeset ea46579 by Erlend Egeberg Aasland in branch 'master':
bpo-40956: Fix segfault when Connection.backup is called without target (GH-24503)
ea46579
pablogsal commentedon Jun 20, 2021
New changeset 185ecdc by Erlend Egeberg Aasland in branch 'main':
bpo-40956: Convert sqlite3.connect and sqlite3.Connection.__init__ to AC (GH-24421)
185ecdc
pablogsal commentedon Jun 20, 2021
Erlend, is anything left in this issue?
erlend-aasland commentedon Jun 20, 2021
Nothing left; thank you for your guidance and reviews, Dong-hee, Berker, Serhiy, and Pablo.