KEMBAR78
gh-105927: Add _PyWeakref_IS_DEAD() function by vstinner · Pull Request #105992 · python/cpython · GitHub
Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner 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
Member Author

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

@vstinner vstinner merged commit c38da1e into python:main Jun 22, 2023
@vstinner vstinner 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
Member Author

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 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.

3 participants