Hopeful fix for issue 1878: remove Py_TPFLAGS_HAVE_VERSION_TAG from

Py_TPFLAGS_DEFAULT when not building the core.
This commit is contained in:
Guido van Rossum 2008-08-19 20:13:02 +00:00
parent 80f0ed5bb1
commit 69ed1011aa
1 changed files with 19 additions and 6 deletions

View File

@ -162,10 +162,10 @@ typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **);
/* Py3k buffer interface */
typedef struct bufferinfo {
void *buf;
void *buf;
PyObject *obj; /* borrowed reference */
Py_ssize_t len;
Py_ssize_t itemsize; /* This is Py_ssize_t so it can be
Py_ssize_t itemsize; /* This is Py_ssize_t so it can be
pointed to by strides in simple case.*/
int readonly;
int ndim;
@ -296,7 +296,7 @@ typedef struct {
segcountproc bf_getsegcount;
charbufferproc bf_getcharbuffer;
getbufferproc bf_getbuffer;
releasebufferproc bf_releasebuffer;
releasebufferproc bf_releasebuffer;
} PyBufferProcs;
@ -530,6 +530,12 @@ Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value.
Code can use PyType_HasFeature(type_ob, flag_value) to test whether the
given type object has a specified feature.
NOTE: when building the core, Py_TPFLAGS_DEFAULT includes
Py_TPFLAGS_HAVE_VERSION_TAG; outside the core, it doesn't. This is so
that extensions that modify tp_dict of their own types directly don't
break, since this was allowed in 2.5. In 3.0 they will have to
manually remove this flag though!
*/
/* PyBufferProcs contains bf_getcharbuffer */
@ -606,7 +612,7 @@ given type object has a specified feature.
#define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30)
#define Py_TPFLAGS_TYPE_SUBCLASS (1L<<31)
#define Py_TPFLAGS_DEFAULT ( \
#define Py_TPFLAGS_DEFAULT_EXTERNAL ( \
Py_TPFLAGS_HAVE_GETCHARBUFFER | \
Py_TPFLAGS_HAVE_SEQUENCE_IN | \
Py_TPFLAGS_HAVE_INPLACEOPS | \
@ -616,8 +622,15 @@ given type object has a specified feature.
Py_TPFLAGS_HAVE_CLASS | \
Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
Py_TPFLAGS_HAVE_INDEX | \
Py_TPFLAGS_HAVE_VERSION_TAG | \
0)
0)
#define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \
Py_TPFLAGS_HAVE_VERSION_TAG)
#ifdef Py_BUILD_CORE
#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_CORE
#else
#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL
#endif
#define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0)
#define PyType_FastSubclass(t,f) PyType_HasFeature(t,f)