GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-31746: Fixed Segfaults in the sqlite module when uninitialized. by lielfr · Pull Request #3946 · python/cpython Conversation
|
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oh, i was in the middle of writing my patch, but i guess you beat me to it :) Anyway, IMHO we should add tests to verify that the crashes we know about don't happen anymore. (i am not sure, but Also, i think that setting BTW, i applied your patch, and calling |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| def CheckUninitializedIsolationLevel(self): | ||
| """ | ||
| Previously trying to get the isolation level of an uninitialized Connection | ||
| caused a segfault, now it should just return None. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Other getters raise a ProgrammingError when they are called on an uninitialized Connection object.
IMHO this should be the same here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@lielfr, please fix the merge conflicts and, if you've addressed all the review comments, please mark them with the 'Resolve conversation' button. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@lielfr, I don't see where @orenmn worked on this issue. Since this pull request had had some activity, I was trying to move it forward by making sure the reviews had been addressed. Can you point out where @orenmn's changes are? Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@lielfr - thank you for pointing those out. They were different issues on the bug tracker, so I didn't think the fix to one fixed the other (one was for cursors and one was for connections). Anyway, that would be great if you could take a look to see if this connection issue still happens and to fix those test issues you mentioned. Thank you for working on this! :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi @csabella, It seems that this pr doesn't receive any attention from the maintainers. Should it just be left like that, or would you recommend reaching out to someone? Thanks again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please fix the PEP 7 issues. Also, the tests are now missing. Could you rebase onto master and add them again?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Sorry for the delay. Will fix this now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Great, there's no hurry :) Thank you! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… made closing an uninitialized connection throw a ProgrammingError instead of segfaulting
|
Should be done. I'll be happy to fix other issues if there are any. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| if (self == NULL) { | ||
| return NULL; | ||
| } | ||
|
|
||
| static char *kwlist[] = {"factory", NULL}; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is not needed if self->initialized is only set if pysqlite_connection_init was successful. Also, it looks like the rebase left some artifacts :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| if (!self->statements) { | ||
| PyErr_SetString(pysqlite_ProgrammingError, | ||
| "Base Connection.__init__ not called."); | ||
| return NULL; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to handle this in pysqlite_do_all_statements, as it has multiple callers? Perhaps pysqlite_do_all_statements could be split in two: do_all_statements and do_all_cursors. Each of them would do a pointer sanity check before looping.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about splitting pysqlite_do_all_statements into two functions? It seems like it always performs the statements part, but optionally also performs the cursors part.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No, I'm not sure :) Let's leave it as it is; both pysqlite_do_all_statements and this particular change.
Nit: if (self->statements == NULL) is more explicit, and I believe more consistent with the rest of the code base.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (!self || !self->isolation_level) { | ||
| PyErr_Format(pysqlite_ProgrammingError, | ||
| "Object is null or isolation_level is uninitialized."); | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If self->initialized is only set if pysqlite_connection_init was successful, this can be reduced to:
| if (!self || !self->isolation_level) { | |
| PyErr_Format(pysqlite_ProgrammingError, | |
| "Object is null or isolation_level is uninitialized."); | |
| return 0; | |
| } | |
| if (!pysqlite_check_connection(self)) { | |
| return NULL; | |
| } |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing, since #27431 is now merged. Thank you for your PR, and interest in improving CPython! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.