FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-105927: Avoid calling PyWeakref_GET_OBJECT() by vstinner · Pull Request #105997 · python/cpython · GitHub

Repository navigation

gh-105927: Avoid calling PyWeakref_GET_OBJECT() - #105997

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:getref_obj
Jun 22, 2023
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:getref_obj

Conversation

vstinner commented Jun 22, 2023 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member
  • Replace PyWeakref_GET_OBJECT() with _PyWeakref_GET_REF().
  • _sqlite/blob.c now holds a strong reference to the blob object while calling close_blob().
  • _xidregistry_find_type() now holds a strong reference to registered while using it.

* Replace PyWeakref_GET_OBJECT() with _PyWeakref_GET_REF().
* _sqlite/blob.c now holds a strong reference to the blob object
  while calling close_blob().
* _xidregistry_find_type() now holds a strong reference to registered
  while using it.
Comment thread Modules/_sqlite/blob.c
PyObject *blob = PyWeakref_GetObject(weakref);
if (!Py_IsNone(blob)) {
close_blob((pysqlite_Blob *)blob);
PyObject *blob = _PyWeakref_GET_REF(weakref);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ideally, we should use public API only in the sqlite3 extension module.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I hesitated to use PyWeakref_GetRef() but pysqlite_close_all_blobs() cannot report errors (return type is void), and I hesitated to use PyErr_WriteUnraisable().

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL