Mercurial > repos > yating-l > jbrowsearchivecreator
annotate test/include/python2.7/weakrefobject.h @ 3:7d1a9a91b989 draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
| author | yating-l | 
|---|---|
| date | Thu, 18 May 2017 18:37:28 -0400 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 3 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 1 /* Weak references objects for Python. */ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 2 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 3 #ifndef Py_WEAKREFOBJECT_H | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 4 #define Py_WEAKREFOBJECT_H | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 5 #ifdef __cplusplus | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 6 extern "C" { | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 7 #endif | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 8 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 9 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 10 typedef struct _PyWeakReference PyWeakReference; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 11 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 12 /* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 13 * and CallableProxyType. | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 14 */ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 15 struct _PyWeakReference { | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 16 PyObject_HEAD | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 17 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 18 /* The object to which this is a weak reference, or Py_None if none. | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 19 * Note that this is a stealth reference: wr_object's refcount is | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 20 * not incremented to reflect this pointer. | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 21 */ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 22 PyObject *wr_object; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 23 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 24 /* A callable to invoke when wr_object dies, or NULL if none. */ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 25 PyObject *wr_callback; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 26 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 27 /* A cache for wr_object's hash code. As usual for hashes, this is -1 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 28 * if the hash code isn't known yet. | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 29 */ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 30 long hash; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 31 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 32 /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 33 * terminated list of weak references to it. These are the list pointers. | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 34 * If wr_object goes away, wr_object is set to Py_None, and these pointers | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 35 * have no meaning then. | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 36 */ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 37 PyWeakReference *wr_prev; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 38 PyWeakReference *wr_next; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 39 }; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 40 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 41 PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 42 PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 43 PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 44 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 45 #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 46 #define PyWeakref_CheckRefExact(op) \ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 47 (Py_TYPE(op) == &_PyWeakref_RefType) | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 48 #define PyWeakref_CheckProxy(op) \ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 49 ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 50 (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 51 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 52 #define PyWeakref_Check(op) \ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 53 (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 54 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 55 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 56 PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 57 PyObject *callback); | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 58 PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 59 PyObject *callback); | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 60 PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 61 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 62 PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 63 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 64 PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 65 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 66 /* Explanation for the Py_REFCNT() check: when a weakref's target is part | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 67 of a long chain of deallocations which triggers the trashcan mechanism, | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 68 clearing the weakrefs can be delayed long after the target's refcount | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 69 has dropped to zero. In the meantime, code accessing the weakref will | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 70 be able to "see" the target object even though it is supposed to be | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 71 unreachable. See issue #16602. */ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 72 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 73 #define PyWeakref_GET_OBJECT(ref) \ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 74 (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 75 ? ((PyWeakReference *)(ref))->wr_object \ | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 76 : Py_None) | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 77 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 78 | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 79 #ifdef __cplusplus | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 80 } | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 81 #endif | 
| 
7d1a9a91b989
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
 yating-l parents: diff
changeset | 82 #endif /* !Py_WEAKREFOBJECT_H */ | 
