mirror of
https://github.com/python/cpython.git
synced 2026-01-04 06:22:20 +00:00
Use a type flag to determine the applicability of the tp_weaklistoffset
field. This should avoid binary incompatibility problems with older modules that have not been recompiled.
This commit is contained in:
parent
26d1f14433
commit
033f31270c
2 changed files with 10 additions and 1 deletions
|
|
@ -271,7 +271,9 @@ extern DL_IMPORT(void) _PyGC_Dump(PyGC_Head *);
|
|||
#endif /* WITH_CYCLE_GC */
|
||||
|
||||
/* Test if a type supports weak references */
|
||||
#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
|
||||
#define PyType_SUPPORTS_WEAKREFS(t) \
|
||||
(PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \
|
||||
&& ((t)->tp_weaklistoffset > 0))
|
||||
|
||||
#define PyObject_GET_WEAKREFS_LISTPTR(o) \
|
||||
((PyObject **) (((char *) (o)) + (o)->ob_type->tp_weaklistoffset))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue