Mercurial > cpython-lru_cache-weakref
annotate Include/tupleobject.h @ 17581:c1937faabb23 2.1
Added support for optional explanation parameter to the \versionadded
macro.
Refactored do_cmd_versionadded() and do_cmd_versionchanged() to do most
of the work in a helper function, with the do_cmd_*() wrappers just supplying
a portion of the replacement text.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Wed, 18 Apr 2001 17:29:14 +0000 |
| parents | 6f6f965c5e2d |
| children | d579a5d8b3fe |
| rev | line source |
|---|---|
| 145 | 1 |
| 6 | 2 /* Tuple object interface */ |
| 3 | |
|
13445
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
4 #ifndef Py_TUPLEOBJECT_H |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
5 #define Py_TUPLEOBJECT_H |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
6 #ifdef __cplusplus |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
7 extern "C" { |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
8 #endif |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
9 |
| 6 | 10 /* |
| 11 Another generally useful object type is an tuple of object pointers. | |
| 12 This is a mutable type: the tuple items can be changed (but not their | |
| 13 number). Out-of-range indices or non-tuple objects are ignored. | |
| 14 | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
15 *** WARNING *** PyTuple_SetItem does not increment the new item's reference |
| 6 | 16 count, but does decrement the reference count of the item it replaces, |
| 17 if not nil. It does *decrement* the reference count if it is *not* | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
18 inserted in the tuple. Similarly, PyTuple_GetItem does not increment the |
| 6 | 19 returned item's reference count. |
| 20 */ | |
| 21 | |
| 86 | 22 typedef struct { |
|
13445
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
23 PyObject_VAR_HEAD |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
24 PyObject *ob_item[1]; |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
25 } PyTupleObject; |
| 86 | 26 |
|
2669
34eefa226709
DL_IMPORT needs an argument.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2664
diff
changeset
|
27 extern DL_IMPORT(PyTypeObject) PyTuple_Type; |
| 6 | 28 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
29 #define PyTuple_Check(op) ((op)->ob_type == &PyTuple_Type) |
| 6 | 30 |
|
13445
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
31 extern DL_IMPORT(PyObject *) PyTuple_New(int size); |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
32 extern DL_IMPORT(int) PyTuple_Size(PyObject *); |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
33 extern DL_IMPORT(PyObject *) PyTuple_GetItem(PyObject *, int); |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
34 extern DL_IMPORT(int) PyTuple_SetItem(PyObject *, int, PyObject *); |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
35 extern DL_IMPORT(PyObject *) PyTuple_GetSlice(PyObject *, int, int); |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
36 extern DL_IMPORT(int) _PyTuple_Resize(PyObject **, int, int); |
| 86 | 37 |
| 38 /* Macro, trading safety for speed */ | |
|
2500
f217c1b27f86
addet SETTUPLEITEM and added cast to GETTUPLEITEM
Guido van Rossum <guido@python.org>
parents:
2436
diff
changeset
|
39 #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) |
|
4898
4f87fd2d0562
added PyTuple_GET_SIZE macro
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
40 #define PyTuple_GET_SIZE(op) (((PyTupleObject *)(op))->ob_size) |
|
2500
f217c1b27f86
addet SETTUPLEITEM and added cast to GETTUPLEITEM
Guido van Rossum <guido@python.org>
parents:
2436
diff
changeset
|
41 |
|
f217c1b27f86
addet SETTUPLEITEM and added cast to GETTUPLEITEM
Guido van Rossum <guido@python.org>
parents:
2436
diff
changeset
|
42 /* Macro, *only* to be used to fill in brand new tuples */ |
|
f217c1b27f86
addet SETTUPLEITEM and added cast to GETTUPLEITEM
Guido van Rossum <guido@python.org>
parents:
2436
diff
changeset
|
43 #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
44 |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
45 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
46 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
47 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
48 #endif /* !Py_TUPLEOBJECT_H */ |
