-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-32788: Better error handling in sqlite3. #3723
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
bpo-32788: Better error handling in sqlite3. #3723
Conversation
PyDict_GetItem()
and PyObject_HasAttrString()
in sqlite3
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an old computer with no SQLite installed at the moment, but I think most of the patch looks good and safe to me. I have a question and a couple of comments:
-
Did you notice these by reading the code or noticed while using the module? For example,
pysqlite_cache_get()
(although it's exposed the cache implementation is an implementation detail and basically useless for third-party uses: https://bugs.python.org/issue30262) is only used by_pysqlite_query_execute()
and it only accepts a string object. The only exception that may be raised here is OOM. -
I'm fine with making old code PEP 7 compliant if you've already change the signature of the function, but in cases like below, I think it's better to keep the old code as-is:
-static int check_cursor(pysqlite_Cursor* cur) +static int +check_cursor(pysqlite_Cursor* cur)
The rest is fine because you've added
static
to them. -
I haven't look at the code in
microprotocols.c
recently, so I still need a bit more time to review it and the code relevant to it (e.g.statement.c
)
By reading the code. Initially I wanted to only fix cases with PyDict_GetItem() and PyObject_HasAttrString(). Then noticed that exceptions are silenced in other cases, and couldn't stop until analyzed all code that silences or replaces exceptions, and also other suspicious code in the
Do you mean just this function or all cases in which the only change is inserting a newline before the function name?
PEP 246 was rejected as a general protocol, but I think it is worth to fix its concrete implementation in sqlite3. This PR is purposed for the master branch only, because of the chance of breaking user code. But some changes can be backported. I am wondering if it is worth to document and test some user-visible behavior changes. I can split this PR on several parts if you prefer. |
I missed that
I think that would be great if you have time to do so :) |
dd78e66
to
c5bc2a6
Compare
@berkerpeksag, have I addressed all your comments? Could you please take a look at this PR again? |
I am going to merge this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! I'd like to deprecate and eventually get rid of this pre-PEP 246 protocol.
BTW, I'm moving to a new country in a month, so I don't have time to closely check my GitHub notifications. Feel free to send me an email if I'm blocking a pull request.
Good luck with your move! 🚋 |
https://bugs.python.org/issue32788