Skip to content

'_PyLong_NumBits': identifier not found in 3.13 #119336

Closed
@clin1234

Description

@clin1234

Bug report

Bug description:

While fixing pywin32 to let CI builds work in Python 3.13, the build process complained of not being able to find _PyLong_NumBits. All other Python versions in the CI built successfully.

BOOL PyCom_VariantFromPyObject(PyObject *obj, VARIANT *var)
{
    // ...
    if (PyLong_Check(obj)) {
        int sign = _PyLong_Sign(obj);
        size_t nbits = _PyLong_NumBits(obj);
        if (nbits == (size_t)-1 && PyErr_Occurred())
            return FALSE;
    // ...
}

The function still exists in main, apparently inaccessible via the public C API since 3.13. What's the recommended replacement?

CPython versions tested on:

3.8, 3.9, 3.10, 3.11, 3.12, 3.13

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions