Uh oh!
There was an error while loading. Please reload this page.
Add PyUnstable_Object_IsUniquelyReferenced - #149
Conversation
5020859 to
02628acCompare
vstinner
left a comment
There was a problem hiding this comment.
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.
| } | ||
| #endif | ||
| #ifndef PYPY_VERSION |
There was a problem hiding this comment.
The function doesn't make sense on PyPy?
There was a problem hiding this comment.
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.
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
commented
Sep 1, 2025
Tests fail on Python 2: |
ngoldbaum
commented
Sep 1, 2025
I guess empty tuples have had reference counting optimizations for a long time! |
vstinner
commented
Sep 1, 2025
Please update also the doc:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
commented
Sep 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.