Mercurial > cpython-lru_cache-weakref
diff Objects/tupleobject.c @ 12925:128e7b994505 legacy-trunk
Thomas Wouters <thomas@xs4all.net>:
The following patch adds "sq_contains" support to rangeobject, and enables
the already-written support for sq_contains in listobject and tupleobject.
The rangeobject "contains" code should be a bit more efficient than the
current default "in" implementation ;-) It might not get used much, but it's
not that much to add.
listobject.c and tupleobject.c already had code for sq_contains, and the
proper struct member was set, but the PyType structure was not extended to
include tp_flags, so the object-specific code was not getting called (Go
ahead, test it ;-). I also did this for the immutable_list_type in
listobject.c, eventhough it is probably never used. Symmetry and all that.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Thu, 15 Jun 2000 14:50:20 +0000 |
| parents | 4272b368bf69 |
| children | 2eef636ba1b6 |
line wrap: on
line diff
--- a/Objects/tupleobject.c Wed Jun 14 09:18:32 2000 +0000 +++ b/Objects/tupleobject.c Thu Jun 15 14:50:20 2000 +0000 @@ -447,6 +447,12 @@ &tuple_as_sequence, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ (hashfunc)tuplehash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ }; /* The following function breaks the notion that tuples are immutable:
