Mercurial > cpython-lru_cache-weakref
annotate Modules/_weakref.c @ 22360:c8a6ea00a9e1 legacy-trunk
restructure a bit to not rely on test case execution ordering
add test case for bug #482460
| author | Skip Montanaro <skip@pobox.com> |
|---|---|
| date | Sun, 17 Mar 2002 23:03:42 +0000 |
| parents | 899bebc89047 |
| children | fe2cfce4e658 ed1ba37a46b7 |
| rev | line source |
|---|---|
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
1 #include "Python.h" |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 #define GET_WEAKREFS_LISTPTR(o) \ |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o)) |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 |
|
16659
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
8 static char weakref_getweakrefcount__doc__[] = |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
9 "getweakrefcount(object) -- return the number of weak references\n" |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
10 "to 'object'."; |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
11 |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 static PyObject * |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
13 weakref_getweakrefcount(PyObject *self, PyObject *object) |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 { |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 PyObject *result = NULL; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
17 if (PyType_SUPPORTS_WEAKREFS(object->ob_type)) { |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
18 PyWeakReference **list = GET_WEAKREFS_LISTPTR(object); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
20 result = PyInt_FromLong(_PyWeakref_GetWeakrefCount(*list)); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
21 } |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
22 else |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
23 result = PyInt_FromLong(0); |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
24 |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
25 return result; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
26 } |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
27 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
28 |
|
16659
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
29 static char weakref_getweakrefs__doc__[] = |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
30 "getweakrefs(object) -- return a list of all weak reference objects\n" |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
31 "that point to 'object'."; |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
32 |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
33 static PyObject * |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
34 weakref_getweakrefs(PyObject *self, PyObject *object) |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 { |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
36 PyObject *result = NULL; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
37 |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
38 if (PyType_SUPPORTS_WEAKREFS(object->ob_type)) { |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
39 PyWeakReference **list = GET_WEAKREFS_LISTPTR(object); |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
40 long count = _PyWeakref_GetWeakrefCount(*list); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
41 |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
42 result = PyList_New(count); |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
43 if (result != NULL) { |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
44 PyWeakReference *current = *list; |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
45 long i; |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
46 for (i = 0; i < count; ++i) { |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
47 PyList_SET_ITEM(result, i, (PyObject *) current); |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
48 Py_INCREF(current); |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
49 current = current->wr_next; |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
50 } |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
51 } |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
52 } |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
53 else { |
|
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
54 result = PyList_New(0); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
55 } |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
56 return result; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
57 } |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
58 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
59 |
|
16659
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
60 static char weakref_ref__doc__[] = |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
61 "new(object[, callback]) -- create a weak reference to 'object';\n" |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
62 "when 'object' is finalized, 'callback' will be called and passed\n" |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
63 "a reference to 'object'."; |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
64 |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
65 static PyObject * |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
66 weakref_ref(PyObject *self, PyObject *args) |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
67 { |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
68 PyObject *object; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
69 PyObject *callback = NULL; |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
70 PyObject *result = NULL; |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
71 |
|
20634
899bebc89047
Convert the ref() and proxy() implementations to use the new
Fred Drake <fdrake@acm.org>
parents:
20285
diff
changeset
|
72 if (PyArg_UnpackTuple(args, "ref", 1, 2, &object, &callback)) { |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
73 result = PyWeakref_NewRef(object, callback); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
74 } |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
75 return result; |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
76 } |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
77 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
78 |
|
16659
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
79 static char weakref_proxy__doc__[] = |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
80 "proxy(object[, callback]) -- create a proxy object that weakly\n" |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
81 "references 'object'. 'callback', if given, is called with a\n" |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
82 "reference to the proxy when it is about to be finalized."; |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
83 |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
84 static PyObject * |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
85 weakref_proxy(PyObject *self, PyObject *args) |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
86 { |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
87 PyObject *object; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
88 PyObject *callback = NULL; |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
89 PyObject *result = NULL; |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
90 |
|
20634
899bebc89047
Convert the ref() and proxy() implementations to use the new
Fred Drake <fdrake@acm.org>
parents:
20285
diff
changeset
|
91 if (PyArg_UnpackTuple(args, "proxy", 1, 2, &object, &callback)) { |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
92 result = PyWeakref_NewProxy(object, callback); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
93 } |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
94 return result; |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
95 } |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
96 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
97 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
98 static PyMethodDef |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
99 weakref_functions[] = { |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
100 {"getweakrefcount", weakref_getweakrefcount, METH_O, |
|
16659
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
101 weakref_getweakrefcount__doc__}, |
|
19306
a7bbac69c8ef
Use METH_O where possible (two functions). This does not lead to real
Fred Drake <fdrake@acm.org>
parents:
17670
diff
changeset
|
102 {"getweakrefs", weakref_getweakrefs, METH_O, |
|
16659
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
103 weakref_getweakrefs__doc__}, |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
104 {"proxy", weakref_proxy, METH_VARARGS, |
|
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
105 weakref_proxy__doc__}, |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
106 {"ref", weakref_ref, METH_VARARGS, |
|
16659
deec6fa80471
Move docstrings out of function table to constants defined near the
Fred Drake <fdrake@acm.org>
parents:
16434
diff
changeset
|
107 weakref_ref__doc__}, |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
108 {NULL, NULL, 0, NULL} |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
109 }; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
110 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
111 |
|
16402
08ac556f2d12
Teach Windows build about the _weakref module.
Tim Peters <tim.peters@gmail.com>
parents:
16385
diff
changeset
|
112 DL_EXPORT(void) |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
113 init_weakref(void) |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
114 { |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
115 PyObject *m; |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
116 |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
117 m = Py_InitModule3("_weakref", weakref_functions, |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
118 "Weak-reference support module."); |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
119 if (m != NULL) { |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
120 Py_INCREF(&_PyWeakref_RefType); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
121 PyModule_AddObject(m, "ReferenceType", |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
122 (PyObject *) &_PyWeakref_RefType); |
|
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
123 Py_INCREF(&_PyWeakref_ProxyType); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
124 PyModule_AddObject(m, "ProxyType", |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
125 (PyObject *) &_PyWeakref_ProxyType); |
|
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
126 Py_INCREF(&_PyWeakref_CallableProxyType); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
127 PyModule_AddObject(m, "CallableProxyType", |
|
20285
ccb7abc714ed
Adjust the _weakref module to use the public API for the weak reference
Fred Drake <fdrake@acm.org>
parents:
19581
diff
changeset
|
128 (PyObject *) &_PyWeakref_CallableProxyType); |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
129 } |
|
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
130 } |
