Mercurial > cpython-lru_cache-weakref
annotate Include/weakrefobject.h @ 32975:9b188158181f legacy-trunk
Typo fix; use 'in-place' instead of 'inplace'
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Fri, 06 Aug 2004 18:55:09 +0000 |
| parents | 4383db77b19a |
| children | facb5a2f4b53 |
| rev | line source |
|---|---|
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
1 /* Weak references objects for Python. */ |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 #ifndef Py_WEAKREFOBJECT_H |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 #define Py_WEAKREFOBJECT_H |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 #ifdef __cplusplus |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 extern "C" { |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 #endif |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
9 |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
10 typedef struct _PyWeakReference PyWeakReference; |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
11 |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 struct _PyWeakReference { |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
13 PyObject_HEAD |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 PyObject *wr_object; |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 PyObject *wr_callback; |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 long hash; |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
17 PyWeakReference *wr_prev; |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
18 PyWeakReference *wr_next; |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 }; |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
20 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20287
diff
changeset
|
21 PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20287
diff
changeset
|
22 PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20287
diff
changeset
|
23 PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
24 |
|
32472
4383db77b19a
Make weak references subclassable:
Fred Drake <fdrake@acm.org>
parents:
30991
diff
changeset
|
25 #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) |
|
4383db77b19a
Make weak references subclassable:
Fred Drake <fdrake@acm.org>
parents:
30991
diff
changeset
|
26 #define PyWeakref_CheckRefExact(op) \ |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
27 ((op)->ob_type == &_PyWeakref_RefType) |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
28 #define PyWeakref_CheckProxy(op) \ |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
29 (((op)->ob_type == &_PyWeakref_ProxyType) || \ |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
30 ((op)->ob_type == &_PyWeakref_CallableProxyType)) |
|
32472
4383db77b19a
Make weak references subclassable:
Fred Drake <fdrake@acm.org>
parents:
30991
diff
changeset
|
31 |
|
4383db77b19a
Make weak references subclassable:
Fred Drake <fdrake@acm.org>
parents:
30991
diff
changeset
|
32 /* This macro calls PyWeakref_CheckRef() last since that can involve a |
|
4383db77b19a
Make weak references subclassable:
Fred Drake <fdrake@acm.org>
parents:
30991
diff
changeset
|
33 function call; this makes it more likely that the function call |
|
4383db77b19a
Make weak references subclassable:
Fred Drake <fdrake@acm.org>
parents:
30991
diff
changeset
|
34 will be avoided. */ |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 #define PyWeakref_Check(op) \ |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
36 (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
37 |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
38 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20287
diff
changeset
|
39 PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
40 PyObject *callback); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20287
diff
changeset
|
41 PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
42 PyObject *callback); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20287
diff
changeset
|
43 PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
44 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20287
diff
changeset
|
45 PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head); |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
46 |
|
30991
14d321466a06
SF bug 839548: Bug in type's GC handling causes segfaults.
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
47 PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); |
|
14d321466a06
SF bug 839548: Bug in type's GC handling causes segfaults.
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
48 |
|
20280
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
49 #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object) |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
50 |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
51 |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
52 #ifdef __cplusplus |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
53 } |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
54 #endif |
|
97cfa461d793
The weak reference implementation, separated from the weakref module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
55 #endif /* !Py_WEAKREFOBJECT_H */ |
