Mercurial > cpython-lru_cache-weakref
annotate Include/descrobject.h @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | fd25030223b0 |
| children |
| rev | line source |
|---|---|
|
20015
ca7af2a5d915
Add optional docstrings to getset descriptors. Fortunately, there's
Guido van Rossum <guido@python.org>
parents:
20012
diff
changeset
|
1 /* Descriptors */ |
|
22688
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
2 #ifndef Py_DESCROBJECT_H |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
3 #define Py_DESCROBJECT_H |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
4 #ifdef __cplusplus |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
5 extern "C" { |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
6 #endif |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
7 |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
8 typedef PyObject *(*getter)(PyObject *, void *); |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
9 typedef int (*setter)(PyObject *, PyObject *, void *); |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
10 |
|
20015
ca7af2a5d915
Add optional docstrings to getset descriptors. Fortunately, there's
Guido van Rossum <guido@python.org>
parents:
20012
diff
changeset
|
11 typedef struct PyGetSetDef { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
12 char *name; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
13 getter get; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
14 setter set; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
15 char *doc; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
16 void *closure; |
|
20015
ca7af2a5d915
Add optional docstrings to getset descriptors. Fortunately, there's
Guido van Rossum <guido@python.org>
parents:
20012
diff
changeset
|
17 } PyGetSetDef; |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
18 |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
19 typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
20 void *wrapped); |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
21 |
|
20599
ff57a1a370b3
Methods of built-in types now properly check for keyword arguments
Guido van Rossum <guido@python.org>
parents:
20586
diff
changeset
|
22 typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
23 void *wrapped, PyObject *kwds); |
|
20599
ff57a1a370b3
Methods of built-in types now properly check for keyword arguments
Guido van Rossum <guido@python.org>
parents:
20586
diff
changeset
|
24 |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
25 struct wrapperbase { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
26 char *name; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
27 int offset; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
28 void *function; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
29 wrapperfunc wrapper; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
30 char *doc; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
31 int flags; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
32 PyObject *name_strobj; |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
33 }; |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
34 |
|
20599
ff57a1a370b3
Methods of built-in types now properly check for keyword arguments
Guido van Rossum <guido@python.org>
parents:
20586
diff
changeset
|
35 /* Flags for above struct */ |
|
ff57a1a370b3
Methods of built-in types now properly check for keyword arguments
Guido van Rossum <guido@python.org>
parents:
20586
diff
changeset
|
36 #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ |
|
ff57a1a370b3
Methods of built-in types now properly check for keyword arguments
Guido van Rossum <guido@python.org>
parents:
20586
diff
changeset
|
37 |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
38 /* Various kinds of descriptor objects */ |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
39 |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
40 #define PyDescr_COMMON \ |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
41 PyObject_HEAD \ |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
42 PyTypeObject *d_type; \ |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
43 PyObject *d_name |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
44 |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
45 typedef struct { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
46 PyDescr_COMMON; |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
47 } PyDescrObject; |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
48 |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
49 typedef struct { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
50 PyDescr_COMMON; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
51 PyMethodDef *d_method; |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
52 } PyMethodDescrObject; |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
53 |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
54 typedef struct { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
55 PyDescr_COMMON; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
56 struct PyMemberDef *d_member; |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
57 } PyMemberDescrObject; |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
58 |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
59 typedef struct { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
60 PyDescr_COMMON; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
61 PyGetSetDef *d_getset; |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
62 } PyGetSetDescrObject; |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
63 |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
64 typedef struct { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
65 PyDescr_COMMON; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
66 struct wrapperbase *d_base; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
67 void *d_wrapped; /* This can be any function pointer */ |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
68 } PyWrapperDescrObject; |
|
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
69 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
70 PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; |
|
53273
42bf56e34825
Merged revisions 71734,71738-71739 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
44350
diff
changeset
|
71 PyAPI_DATA(PyTypeObject) PyDictProxy_Type; |
|
42bf56e34825
Merged revisions 71734,71738-71739 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
44350
diff
changeset
|
72 PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; |
|
42bf56e34825
Merged revisions 71734,71738-71739 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
44350
diff
changeset
|
73 PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; |
|
20229
8bad55edfdf3
*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum <guido@python.org>
parents:
20015
diff
changeset
|
74 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
75 PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); |
|
26583
8991f78817c7
SF 548651: Fix the METH_CLASS implementation.
Tim Peters <tim.peters@gmail.com>
parents:
24896
diff
changeset
|
76 PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
77 PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
78 struct PyMemberDef *); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
79 PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
80 struct PyGetSetDef *); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
81 PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
53273
diff
changeset
|
82 struct wrapperbase *, void *); |
|
44350
26384b8180c7
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.
Christian Heimes <christian@cheimes.de>
parents:
42334
diff
changeset
|
83 #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
diff
changeset
|
84 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
85 PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
86 PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); |
|
19456
3b5f34c5bc6c
Add new built-in type 'getset' (PyGetSet_Type).
Guido van Rossum <guido@python.org>
parents:
18933
diff
changeset
|
87 |
|
3b5f34c5bc6c
Add new built-in type 'getset' (PyGetSet_Type).
Guido van Rossum <guido@python.org>
parents:
18933
diff
changeset
|
88 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22688
diff
changeset
|
89 PyAPI_DATA(PyTypeObject) PyProperty_Type; |
|
22688
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
90 #ifdef __cplusplus |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
91 } |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
92 #endif |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
93 #endif /* !Py_DESCROBJECT_H */ |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
20599
diff
changeset
|
94 |
