Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33
Add PyUnstable_Object_IsUniquelyReferenced#149
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
5020859 to02628acCompare
vstinner left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you please rebase your PR on the updated main branch to get tests on Free Threaded builds?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
tests/test_pythoncapi_compat_cext.c Outdated
| } | ||
| #endif | ||
| #ifndefPYPY_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The function doesn't make sense on PyPy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Apparently not, maybe an interned string? I rewrote it to use an empty tuple and that seems to work on PyPy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I rewrote it to use an empty tuple and that seems to work on PyPy.
but that seems to have broken other builds, let me see if I can get it working everywhere...
vstinner commentedSep 1, 2025
Tests fail on Python 2: |
ngoldbaum commentedSep 1, 2025
I guess empty tuples have had reference counting optimizations for a long time! |
vstinner commentedSep 1, 2025
Please update also the doc:
|
Uh oh!
There was an error while loading.Please reload this page.
90c06a4 intopython:mainUh oh!
There was an error while loading.Please reload this page.
vstinner commentedSep 1, 2025
Merged, thanks for your contribution. I'm not very excited by adding |
Adds a shim for
PyUnstable_Object_IsUniquelyReferencedand a test for the shim.I'd like to use this function in a few libraries but don't want to have to have a thread-unsafe check in 3.13 or add new uses of internal headers outside of the compat header here.
I'm not sure whether the using stuff from internal headers is ok in a shim like this. I'm also not sure if you want to avoid
PyUnstablefunctions in the compat headers.The implementation is copy/pasted from the implementation of
_PyObject_IsUniquelyReferenced.