summaryrefslogtreecommitdiff
path: root/Include/object.h
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-02-15 17:27:45 +0000
committerMartin v. Löwis <martin@v.loewis.de>2006-02-15 17:27:45 +0000
commit26a6348f77faff1083d501950812ea9f68eb9547 (patch)
tree8aebd3631f3b60d9753cd8271c0ad7c1379af1a2 /Include/object.h
parentad4cf65e988f853a3b32a7da30198ce9c6c73c02 (diff)
downloadcpython-26a6348f77faff1083d501950812ea9f68eb9547.tar.gz
Merge ssize_t branch.
Diffstat (limited to 'Include/object.h')
-rw-r--r--Include/object.h48
1 files changed, 31 insertions, 17 deletions
diff --git a/Include/object.h b/Include/object.h
index ed6f3d1068..faa3057151 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -92,7 +92,8 @@ whose size is determined when the object is allocated.
*/
#define PyObject_VAR_HEAD \
PyObject_HEAD \
- int ob_size; /* Number of items in variable part */
+ Py_ssize_t ob_size; /* Number of items in variable part */
+#define Py_INVALID_SIZE (Py_ssize_t)-1
/* Nothing is actually declared to be a PyObject, but every pointer to
* a Python object can be cast to a PyObject*. This is inheritance built
@@ -127,16 +128,29 @@ typedef PyObject * (*unaryfunc)(PyObject *);
typedef PyObject * (*binaryfunc)(PyObject *, PyObject *);
typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *);
typedef int (*inquiry)(PyObject *);
+typedef Py_ssize_t (*lenfunc)(PyObject *);
typedef int (*coercion)(PyObject **, PyObject **);
-typedef PyObject *(*intargfunc)(PyObject *, int);
-typedef PyObject *(*intintargfunc)(PyObject *, int, int);
+typedef PyObject *(*intargfunc)(PyObject *, int) Py_DEPRECATED(2.5);
+typedef PyObject *(*intintargfunc)(PyObject *, int, int) Py_DEPRECATED(2.5);
+typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t);
+typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t);
typedef int(*intobjargproc)(PyObject *, int, PyObject *);
typedef int(*intintobjargproc)(PyObject *, int, int, PyObject *);
+typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *);
+typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
+
+/* int-based buffer interface */
typedef int (*getreadbufferproc)(PyObject *, int, void **);
typedef int (*getwritebufferproc)(PyObject *, int, void **);
typedef int (*getsegcountproc)(PyObject *, int *);
typedef int (*getcharbufferproc)(PyObject *, int, const char **);
+/* ssize_t-based buffer interface */
+typedef Py_ssize_t (*readbufferproc)(PyObject *, Py_ssize_t, void **);
+typedef Py_ssize_t (*writebufferproc)(PyObject *, Py_ssize_t, void **);
+typedef Py_ssize_t (*segcountproc)(PyObject *, Py_ssize_t *);
+typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, const char **);
+
typedef int (*objobjproc)(PyObject *, PyObject *);
typedef int (*visitproc)(PyObject *, void *);
typedef int (*traverseproc)(PyObject *, visitproc, void *);
@@ -195,30 +209,30 @@ typedef struct {
} PyNumberMethods;
typedef struct {
- inquiry sq_length;
+ lenfunc sq_length;
binaryfunc sq_concat;
- intargfunc sq_repeat;
- intargfunc sq_item;
- intintargfunc sq_slice;
- intobjargproc sq_ass_item;
- intintobjargproc sq_ass_slice;
+ ssizeargfunc sq_repeat;
+ ssizeargfunc sq_item;
+ ssizessizeargfunc sq_slice;
+ ssizeobjargproc sq_ass_item;
+ ssizessizeobjargproc sq_ass_slice;
objobjproc sq_contains;
/* Added in release 2.0 */
binaryfunc sq_inplace_concat;
- intargfunc sq_inplace_repeat;
+ ssizeargfunc sq_inplace_repeat;
} PySequenceMethods;
typedef struct {
- inquiry mp_length;
+ lenfunc mp_length;
binaryfunc mp_subscript;
objobjargproc mp_ass_subscript;
} PyMappingMethods;
typedef struct {
- getreadbufferproc bf_getreadbuffer;
- getwritebufferproc bf_getwritebuffer;
- getsegcountproc bf_getsegcount;
- getcharbufferproc bf_getcharbuffer;
+ readbufferproc bf_getreadbuffer;
+ writebufferproc bf_getwritebuffer;
+ segcountproc bf_getsegcount;
+ charbufferproc bf_getcharbuffer;
} PyBufferProcs;
@@ -239,7 +253,7 @@ typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *);
typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *);
typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
-typedef PyObject *(*allocfunc)(struct _typeobject *, int);
+typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t);
typedef struct _typeobject {
PyObject_VAR_HEAD
@@ -362,7 +376,7 @@ PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
#define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type)
PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
-PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, int);
+PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);