diff options
author | Guido van Rossum <guido@python.org> | 2006-03-07 18:50:55 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-03-07 18:50:55 (GMT) |
commit | 38fff8c4e4276e4e57660a78f305e68bfa87874b (patch) | |
tree | 5f79c06159053f9c7113410fc69dccba01e331ab /Include | |
parent | 9d7855076a8e030e30459de685e762f63bdecac6 (diff) | |
download | cpython-38fff8c4e4276e4e57660a78f305e68bfa87874b.zip cpython-38fff8c4e4276e4e57660a78f305e68bfa87874b.tar.gz cpython-38fff8c4e4276e4e57660a78f305e68bfa87874b.tar.bz2 |
Checking in the code for PEP 357.
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
Diffstat (limited to 'Include')
-rw-r--r-- | Include/abstract.h | 8 | ||||
-rw-r--r-- | Include/object.h | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index 73dc91d..9ec18fa 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -748,6 +748,14 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ + PyAPI_FUNC(Py_ssize_t) PyNumber_Index(PyObject *); + + /* + Returns the object converted to Py_ssize_t on success + or -1 with an error raised on failure. + */ + + PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o); /* diff --git a/Include/object.h b/Include/object.h index 2eb2b44..131812f 100644 --- a/Include/object.h +++ b/Include/object.h @@ -206,6 +206,9 @@ typedef struct { binaryfunc nb_true_divide; binaryfunc nb_inplace_floor_divide; binaryfunc nb_inplace_true_divide; + + /* Added in release 2.5 */ + lenfunc nb_index; } PyNumberMethods; typedef struct { @@ -503,13 +506,16 @@ given type object has a specified feature. /* Objects support garbage collection (see objimp.h) */ #define Py_TPFLAGS_HAVE_GC (1L<<14) -/* These two bits are preserved for Stackless Python, next after this is 16 */ +/* These two bits are preserved for Stackless Python, next after this is 17 */ #ifdef STACKLESS #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<15) #else #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 #endif +/* Objects support nb_index in PyNumberMethods */ +#define Py_TPFLAGS_HAVE_INDEX (1L<<17) + #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ Py_TPFLAGS_HAVE_SEQUENCE_IN | \ @@ -519,6 +525,7 @@ given type object has a specified feature. Py_TPFLAGS_HAVE_ITER | \ Py_TPFLAGS_HAVE_CLASS | \ Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ + Py_TPFLAGS_HAVE_INDEX | \ 0) #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) |