Skip to content

Conversation

@Alvaro-Kothe
Copy link
Member


Just want to point out that this definition is somewhat useless because just below this definition we have:

# Python version compatibility for PyUnstable_Object_IsUniqueReferencedTemporary
cdef inline bint _is_unique_referenced_temporary(object obj) except -1:
    if PY_VERSION_HEX >= 0x030E0000:
        # Python 3.14+ has PyUnstable_Object_IsUniqueReferencedTemporary
        return PyUnstable_Object_IsUniqueReferencedTemporary(obj)
    else:
        # Fallback for older Python versions using sys.getrefcount
        return sys.getrefcount(obj) <= 1

The new definition isn't used for Python<3.14, and uses the CPython definition for Python >=3.14. But at least the symbol is defined and won't cause import errors:

$ nm build/cp313d/pandas/_libs/internals.cpython-313d-x86_64-linux-gnu.so | grep Unique
0000000000000d00 t __Pyx_PyUnstable_Object_IsUniqueReferencedTemporary

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

lgtm assuming green, cc @jorisvandenbossche

@rhshadrach rhshadrach added Build Library building on various platforms Bug labels Nov 16, 2025
@rhshadrach rhshadrach added this to the 3.0 milestone Nov 16, 2025
#if PY_VERSION_HEX < 0x030E0000
int __Pyx_PyUnstable_Object_IsUniqueReferencedTemporary(PyObject *ref);
int __Pyx_PyUnstable_Object_IsUniqueReferencedTemporary(PyObject *ref) {
return Py_REFCNT(ref) == 1;
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment here that this is unused and just added to avoid a build warning?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

I actually had to define it to prevent import errors in debug builds. When you build with optimizations, the compiler removes the declaration, but debug builds has this symbol undefined, which causes import errors.

@jorisvandenbossche
Copy link
Member

Yes, this is certainly fine if that avoids the build warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Build Library building on various platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: undefined symbol when building Pandas with a custom python installation

3 participants