Skip to content

bpo-43852: Improve tuple creation in sqlite3 #25421

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

Merged

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Apr 15, 2021

  • Use PyTuple_SET_ITEM iso. PyTuple_SetItem
  • In _pysqlite_query_execute, minimise decref's in case of error

https://bugs.python.org/issue43852

@erlend-aasland
Copy link
Contributor Author

skip news

@erlend-aasland erlend-aasland force-pushed the sqlite-harden-tuple-creation branch from cf6480b to cfbb0c5 Compare April 15, 2021 10:52
Copy link
Member

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

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

I don't think the title of the PR is accurate. My understanding is that "harden tuple creation" would mean checking return value of each PyTuple_SetItem calls and Py_DECREF any objects if needed. This PR simply replaces PyTuple_SetItem calls with a macro that doesn't do any error checking. I'm fine with the PR as is, but I don't think it would harden tuple creation as it claimed.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be put in the comfy chair!

@erlend-aasland erlend-aasland changed the title bpo-43852: Harden tuple creation in sqlite3 bpo-43852: Improve tuple creation in sqlite3 Apr 15, 2021
@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented Apr 15, 2021

I don't think the title of the PR is accurate.

I agree. I started out adding error checking to PyTuple_SetItem, but soon decided using PyTuple_SET_ITEM was better. I changed the title from harden to improve. Ok?

EDIT
The building of the cursor description is actually hardened: PyTuple_SetItem without error checking has been traded with PyTuple_Pack with error checking.

Nitpick: I don't like the variable name descriptor. I would prefer description or descr.

@erlend-aasland
Copy link
Contributor Author

Thanks for reviewing, @berkerpeksag! I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@berkerpeksag: please review the changes made to this pull request.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

These are the changes I hesitated to make.

@erlend-aasland
Copy link
Contributor Author

Thank you for reviewing, @serhiy-storchaka !

@erlend-aasland
Copy link
Contributor Author

Let me know if there are other changes you want me to address, @berkerpeksag.

@erlend-aasland
Copy link
Contributor Author

Thanks for reviewing, @methane!

@berkerpeksag berkerpeksag merged commit e9194ea into python:master Apr 23, 2021
@berkerpeksag
Copy link
Member

Thank you!

@erlend-aasland erlend-aasland deleted the sqlite-harden-tuple-creation branch April 23, 2021 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants