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
crash and refleaks when calling sqlite3.Cursor.__init__() more than once #75951
Comments
The following code crashes: connection = sqlite3.connect(":memory:")
cursor = sqlite3.Cursor(connection)
ref = weakref.ref(cursor, callback)
cursor.__init__(connection)
del cursor
del ref IIUC, this is because pysqlite_cursor_init() (in Modules/_sqlite/cursor.c) sets In every other place (that i saw) where such a weakreflist field is used, it is Also, the following code results in refleaks: This is because pysqlite_cursor_init() doesn't decref before assigning to I would open a PR to fix this soon. |
Thank you Oren Milman for your bug report and the bug fix! I merged your PR and backported it Python 3.6 and 2.7. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: