Skip to content

PyWeakref_GetObject removed in Python 3.15 #3966

@musicinmybrain

Description

@musicinmybrain

For Python 3.15, the PyWeakref_GetObject function, deprecated since Python 3.13, will be removed from the Python C API. The recommendation is to use PyWeakref_GetRef) instead.

The following uses of PyWeakref_GetObject need to be replaced for compatibility with Python 3.15.

pxr_boost::python::object
Tf_PyWeakObject::GetObject() const
{
return pxr_boost::python::object
(pxr_boost::python::handle<>
(pxr_boost::python::borrowed(PyWeakref_GetObject(_weakRef.get()))));
}

PyObject *
Tf_PyIdHandle::Ptr() const {
if (_weakRef) {
TfPyLock lock;
return PyWeakref_GetObject(_weakRef);
}
return 0;
}

object callable(handle<>(borrowed(PyWeakref_GetObject(weak.ptr()))));

PyObject *self = PyWeakref_GetObject(weakSelf.ptr());

Originally reported downstream in Fedora.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions