mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
This commit is contained in:
parent
b1994b4a5d
commit
6819210b9e
129 changed files with 1090 additions and 1250 deletions
|
@ -34,8 +34,8 @@ typedef struct {
|
|||
PyAPI_DATA(PyTypeObject) PyTuple_Type;
|
||||
|
||||
#define PyTuple_Check(op) \
|
||||
PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
|
||||
#define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type)
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TUPLE_SUBCLASS)
|
||||
#define PyTuple_CheckExact(op) (Py_Type(op) == &PyTuple_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
|
||||
PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
|
||||
|
@ -47,7 +47,7 @@ PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
|
|||
|
||||
/* Macro, trading safety for speed */
|
||||
#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
|
||||
#define PyTuple_GET_SIZE(op) (((PyTupleObject *)(op))->ob_size)
|
||||
#define PyTuple_GET_SIZE(op) Py_Size(op)
|
||||
|
||||
/* Macro, *only* to be used to fill in brand new tuples */
|
||||
#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue