mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-105927: Deprecate PyWeakref_GetObject() function (#106006)
Deprecate PyWeakref_GetObject() and PyWeakref_GET_OBJECT() functions.
This commit is contained in:
parent
dac3d389e7
commit
c075a1974b
7 changed files with 33 additions and 4 deletions
|
@ -923,7 +923,12 @@ PyWeakref_GetObject(PyObject *ref)
|
|||
PyErr_BadInternalCall();
|
||||
return NULL;
|
||||
}
|
||||
return PyWeakref_GET_OBJECT(ref);
|
||||
PyObject *obj = _PyWeakref_GET_REF(ref);
|
||||
if (obj == NULL) {
|
||||
return Py_None;
|
||||
}
|
||||
Py_DECREF(obj);
|
||||
return obj; // borrowed reference
|
||||
}
|
||||
|
||||
/* Note that there's an inlined copy-paste of handle_callback() in gcmodule.c's
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue