Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Include/weakrefobject.h

    r2 r391  
    5050         (Py_TYPE(op) == &_PyWeakref_CallableProxyType))
    5151
    52 /* This macro calls PyWeakref_CheckRef() last since that can involve a
    53    function call; this makes it more likely that the function call
    54    will be avoided. */
    5552#define PyWeakref_Check(op) \
    5653        (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
     
    6764PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
    6865
    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)
    7077
    7178
Note: See TracChangeset for help on using the changeset viewer.