mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-111178: Fix function signatures in weakrefobject.c (#124903)
This commit is contained in:
parent
8d7d257f6b
commit
1ea6672a6f
2 changed files with 25 additions and 20 deletions
|
|
@ -42,13 +42,13 @@ struct _PyWeakReference {
|
|||
|
||||
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
|
||||
|
||||
#define _PyWeakref_CAST(op) \
|
||||
(assert(PyWeakref_Check(op)), _Py_CAST(PyWeakReference*, (op)))
|
||||
|
||||
Py_DEPRECATED(3.13) static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj)
|
||||
{
|
||||
PyWeakReference *ref;
|
||||
PyObject *obj;
|
||||
assert(PyWeakref_Check(ref_obj));
|
||||
ref = _Py_CAST(PyWeakReference*, ref_obj);
|
||||
obj = ref->wr_object;
|
||||
PyWeakReference *ref = _PyWeakref_CAST(ref_obj);
|
||||
PyObject *obj = ref->wr_object;
|
||||
// Explanation for the Py_REFCNT() check: when a weakref's target is part
|
||||
// of a long chain of deallocations which triggers the trashcan mechanism,
|
||||
// clearing the weakrefs can be delayed long after the target's refcount
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue