Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commented Jun 22, 2023

  • Add _PyWeakref_IS_DEAD() internal function.
  • Modify is_dead_weakref() of Modules/_weakref.c and _pysqlite_drop_unused_cursor_references() to replace PyWeakref_GET_OBJECT() with _PyWeakref_IS_DEAD().
  • Replace "int i" with "Py_ssize_t i" to iterate on cursors in _pysqlite_drop_unused_cursor_references().

* Add _PyWeakref_IS_DEAD() internal function. * Modify is_dead_weakref() of Modules/_weakref.c and _pysqlite_drop_unused_cursor_references() to replace PyWeakref_GET_OBJECT() with _PyWeakref_IS_DEAD(). * Replace "int i" with "Py_ssize_t i" to iterate on cursors in _pysqlite_drop_unused_cursor_references().
@vstinner
Copy link
MemberAuthor

@erlend-aasland: PR to prepare PyWeakref_GET_OBJECT() deprecation. It changes the sqlite source code :-)

@vstinnervstinner merged commit c38da1e into python:mainJun 22, 2023
@vstinnervstinner deleted the getref_dead branch June 22, 2023 19:56
@erlend-aasland
Copy link
Contributor

That's a nice improvement for sqlite3 :)

@vstinner
Copy link
MemberAuthor

That's a nice improvement for sqlite3 :)

You may also like PR #105997 which is closer to a real bugfix (reduce the risk of race condition thanks to the usage of a strong reference).

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vstinner@erlend-aasland@bedevere-bot