[Python-checkins] r65874 - python/trunk/Include/object.h
guido.van.rossum
python-checkins at python.org
Tue Aug 19 22:13:02 CEST 2008
Author: guido.van.rossum
Date: Tue Aug 19 22:13:02 2008
New Revision: 65874
Log:
Hopeful fix for issue 1878: remove Py_TPFLAGS_HAVE_VERSION_TAG from
Py_TPFLAGS_DEFAULT when not building the core.
Modified:
python/trunk/Include/object.h
Modified: python/trunk/Include/object.h
==============================================================================
--- python/trunk/Include/object.h (original)
+++ python/trunk/Include/object.h Tue Aug 19 22:13:02 2008
@@ -162,10 +162,10 @@
/* 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 @@
segcountproc bf_getsegcount;
charbufferproc bf_getcharbuffer;
getbufferproc bf_getbuffer;
- releasebufferproc bf_releasebuffer;
+ releasebufferproc bf_releasebuffer;
} PyBufferProcs;
@@ -530,6 +530,12 @@
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 @@
#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 @@
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)
More information about the Python-checkins
mailing list