Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b3f0d34

Browse files
committed
PyObject_ClearWeakRefs() is now a real function instead of a function pointer;
the implementation is in Objects/weakrefobject.c.
1 parent 502ed82 commit b3f0d34

2 files changed

Lines changed: 1 addition & 16 deletions

File tree

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ extern DL_IMPORT(int) PyCallable_Check(PyObject *);
345345
extern DL_IMPORT(int) PyNumber_Coerce(PyObject **, PyObject **);
346346
extern DL_IMPORT(int) PyNumber_CoerceEx(PyObject **, PyObject **);
347347

348-
extern DL_IMPORT(void) (*PyObject_ClearWeakRefs)(PyObject *);
348+
extern DL_IMPORT(void) PyObject_ClearWeakRefs(PyObject *);
349349

350350
/* A slot function whose address we need to compare */
351351
extern int _PyObject_SlotCompare(PyObject *, PyObject *);

Objects/object.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,21 +1841,6 @@ PyObject_Free(void *p)
18411841
}
18421842

18431843

1844-
/* Hook to clear up weak references only once the _weakref module is
1845-
imported. We use a dummy implementation to simplify the code at each
1846-
call site instead of requiring a test for NULL.
1847-
*/
1848-
1849-
static void
1850-
empty_clear_weak_refs(PyObject *o)
1851-
{
1852-
return;
1853-
}
1854-
1855-
void (*PyObject_ClearWeakRefs)(PyObject *) = empty_clear_weak_refs;
1856-
1857-
1858-
18591844
/* These methods are used to control infinite recursion in repr, str, print,
18601845
etc. Container objects that may recursively contain themselves,
18611846
e.g. builtin dictionaries and lists, should used Py_ReprEnter() and

0 commit comments

Comments
 (0)