Changeset 391 for python/trunk/Include/weakrefobject.h
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Include/weakrefobject.h
r2 r391 50 50 (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) 51 51 52 /* This macro calls PyWeakref_CheckRef() last since that can involve a53 function call; this makes it more likely that the function call54 will be avoided. */55 52 #define PyWeakref_Check(op) \ 56 53 (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) … … 67 64 PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); 68 65 69 #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object) 66 /* Explanation for the Py_REFCNT() check: when a weakref's target is part 67 of a long chain of deallocations which triggers the trashcan mechanism, 68 clearing the weakrefs can be delayed long after the target's refcount 69 has dropped to zero. In the meantime, code accessing the weakref will 70 be able to "see" the target object even though it is supposed to be 71 unreachable. See issue #16602. */ 72 73 #define PyWeakref_GET_OBJECT(ref) \ 74 (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ 75 ? ((PyWeakReference *)(ref))->wr_object \ 76 : Py_None) 70 77 71 78
Note:
See TracChangeset
for help on using the changeset viewer.