diff options
author | Guido van Rossum <guido@python.org> | 2000-02-28 15:00:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-02-28 15:00:40 (GMT) |
commit | cecb27a49ca1285fc6fb3190d52768abf85847d1 (patch) | |
tree | 7a1d673f88492988f7afe429b785c8fb4e5dbb4a /Include | |
parent | 84a74595f784c5a6f8138bed0235a5b86d175edb (diff) | |
download | cpython-cecb27a49ca1285fc6fb3190d52768abf85847d1.zip cpython-cecb27a49ca1285fc6fb3190d52768abf85847d1.tar.gz cpython-cecb27a49ca1285fc6fb3190d52768abf85847d1.tar.bz2 |
Patch by Mozhe Zadka, for __contains__ (overloading 'in'). This adds
a new proc type (objobjproc), a new slot sq_contains to
PySequenceMethods, and a new flag Py_TPFLAGS_HAVE_SEQUENCE_IN to
Py_TPFLAGS_DEFAULT. More to follow.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/object.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Include/object.h b/Include/object.h index 4375949..e39f0fa 100644 --- a/Include/object.h +++ b/Include/object.h @@ -150,6 +150,7 @@ typedef int (*getreadbufferproc) Py_PROTO((PyObject *, int, void **)); typedef int (*getwritebufferproc) Py_PROTO((PyObject *, int, void **)); typedef int (*getsegcountproc) Py_PROTO((PyObject *, int *)); typedef int (*getcharbufferproc) Py_PROTO((PyObject *, int, const char **)); +typedef int (*objobjproc) Py_PROTO((PyObject *, PyObject *)); typedef struct { binaryfunc nb_add; @@ -185,6 +186,7 @@ typedef struct { intintargfunc sq_slice; intobjargproc sq_ass_item; intintobjargproc sq_ass_slice; + objobjproc sq_contains; } PySequenceMethods; typedef struct { @@ -317,7 +319,11 @@ given type object has a specified feature. /* PyBufferProcs contains bf_getcharbuffer */ #define Py_TPFLAGS_HAVE_GETCHARBUFFER (1L<<0) -#define Py_TPFLAGS_DEFAULT (Py_TPFLAGS_HAVE_GETCHARBUFFER) +/* PySequenceMethods contains sq_contains */ +#define Py_TPFLAGS_HAVE_SEQUENCE_IN (1L<<1) + +#define Py_TPFLAGS_DEFAULT (Py_TPFLAGS_HAVE_GETCHARBUFFER | \ + Py_TPFLAGS_HAVE_SEQUENCE_IN) #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) |