@@ -147,11 +147,7 @@ typedef int (*visitproc)(PyObject *, void *);
147147typedef int (* traverseproc )(PyObject * , visitproc , void * );
148148
149149typedef struct {
150- /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all
151- arguments are guaranteed to be of the object's type (modulo
152- coercion hacks -- i.e. if the type's coercion function
153- returns other types, then these are allowed as well). Numbers that
154- have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both*
150+ /* Number implementations should check *both*
155151 arguments for proper type and implement the necessary conversions
156152 in the slot functions themselves. */
157153
@@ -444,42 +440,16 @@ Arbitration of the flag bit positions will need to be coordinated among
444440all extension writers who publically release their extensions (this will
445441be fewer than you might expect!)..
446442
447- Python 1.5.2 introduced the bf_getcharbuffer slot into PyBufferProcs.
443+ Most flags were removed as of Python 3.0 to make room for new flags. (Some
444+ flags are not for backwards compatibility but to indicate the presence of an
445+ optional feature; these flags remain of course.)
448446
449447Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value.
450448
451449Code can use PyType_HasFeature(type_ob, flag_value) to test whether the
452450given type object has a specified feature.
453451*/
454452
455- /* PyBufferProcs contains bf_getcharbuffer */
456- #define Py_TPFLAGS_HAVE_GETCHARBUFFER (1L<<0)
457-
458- /* PySequenceMethods contains sq_contains */
459- #define Py_TPFLAGS_HAVE_SEQUENCE_IN (1L<<1)
460-
461- /* This is here for backwards compatibility. Extensions that use the old GC
462- * API will still compile but the objects will not be tracked by the GC. */
463- #define Py_TPFLAGS_GC 0 /* used to be (1L<<2) */
464-
465- /* PySequenceMethods and PyNumberMethods contain in-place operators */
466- #define Py_TPFLAGS_HAVE_INPLACEOPS (1L<<3)
467-
468- /* PyNumberMethods do their own coercion */
469- #define Py_TPFLAGS_CHECKTYPES (1L<<4)
470-
471- /* tp_richcompare is defined */
472- #define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5)
473-
474- /* Objects which are weakly referencable if their tp_weaklistoffset is >0 */
475- #define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6)
476-
477- /* tp_iter is defined */
478- #define Py_TPFLAGS_HAVE_ITER (1L<<7)
479-
480- /* New members introduced by Python 2.2 exist */
481- #define Py_TPFLAGS_HAVE_CLASS (1L<<8)
482-
483453/* Set if the type object is dynamically allocated */
484454#define Py_TPFLAGS_HEAPTYPE (1L<<9)
485455
@@ -502,19 +472,8 @@ given type object has a specified feature.
502472#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0
503473#endif
504474
505- /* Objects support nb_index in PyNumberMethods */
506- #define Py_TPFLAGS_HAVE_INDEX (1L<<17)
507-
508475#define Py_TPFLAGS_DEFAULT ( \
509- Py_TPFLAGS_HAVE_GETCHARBUFFER | \
510- Py_TPFLAGS_HAVE_SEQUENCE_IN | \
511- Py_TPFLAGS_HAVE_INPLACEOPS | \
512- Py_TPFLAGS_HAVE_RICHCOMPARE | \
513- Py_TPFLAGS_HAVE_WEAKREFS | \
514- Py_TPFLAGS_HAVE_ITER | \
515- Py_TPFLAGS_HAVE_CLASS | \
516476 Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
517- Py_TPFLAGS_HAVE_INDEX | \
518477 0)
519478
520479#define PyType_HasFeature (t ,f ) (((t)->tp_flags & (f)) != 0)
0 commit comments