Skip to content
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

gh-105927: Add _PyWeakref_IS_DEAD() function #105992

Merged
merged 1 commit into from
Jun 22, 2023
Merged

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