summaryrefslogtreecommitdiff
path: root/Include/abstract.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/abstract.h')
-rw-r--r--Include/abstract.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index 159e67d7f2..3e5cf129f8 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -532,9 +532,10 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* new buffer API */
#define PyObject_CheckBuffer(obj) \
- (((obj)->ob_type->tp_as_buffer != NULL) && \
- ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
-
+ (((obj)->ob_type->tp_as_buffer != NULL) && \
+ (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \
+ ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
+
/* Return 1 if the getbuffer function is available, otherwise
return 0 */