summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-07 23:13:53 (GMT)
committerGitHub <noreply@github.com>2020-04-07 23:13:53 (GMT)
commitef5c615f5ae72c4f6979159c94da46afefbfab9a (patch)
tree85213408d6eaa43d1bd6c013f5e1cb0d921534be /Include/cpython
parent9205520d8c43488696d66cbdd9aefbb21871c508 (diff)
downloadcpython-ef5c615f5ae72c4f6979159c94da46afefbfab9a.zip
cpython-ef5c615f5ae72c4f6979159c94da46afefbfab9a.tar.gz
cpython-ef5c615f5ae72c4f6979159c94da46afefbfab9a.tar.bz2
bpo-40170: Convert PyObject_CheckBuffer() macro to a function (GH-19376)
Convert PyObject_CheckBuffer() macro to a function to hide implementation details: the macro accessed directly the PyTypeObject.tp_as_buffer member.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/abstract.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h
index 9d23c8c..3f834ff 100644
--- a/Include/cpython/abstract.h
+++ b/Include/cpython/abstract.h
@@ -264,9 +264,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
/* === New Buffer API ============================================ */
/* Return 1 if the getbuffer function is available, otherwise return 0. */
-#define PyObject_CheckBuffer(obj) \
- ((Py_TYPE(obj)->tp_as_buffer != NULL) && \
- (Py_TYPE(obj)->tp_as_buffer->bf_getbuffer != NULL))
+PyAPI_FUNC(int) PyObject_CheckBuffer(PyObject *obj);
/* This is a C-API version of the getbuffer function call. It checks
to make sure object has the required function pointer and issues the