diff options
author | Victor Stinner <vstinner@python.org> | 2022-02-22 22:11:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 22:11:48 (GMT) |
commit | 66b3cd7063322a9f5c922a97bbd06fdb98309999 (patch) | |
tree | 47e0543c2349afa7e57b6d167a7763828a714577 /Include | |
parent | b899126094731bc49fecb61f2c1b7557d74ca839 (diff) | |
download | cpython-66b3cd7063322a9f5c922a97bbd06fdb98309999.zip cpython-66b3cd7063322a9f5c922a97bbd06fdb98309999.tar.gz cpython-66b3cd7063322a9f5c922a97bbd06fdb98309999.tar.bz2 |
bpo-45459: Rename buffer.h to pybuffer.h (#31201)
Rename Include/buffer.h header file to Include/pybuffer.h to avoid
conflicts with projects having an existing "buffer.h" header file.
* Incude pybuffer.h before object.h in Python.h.
* Remove #include "buffer.h" from Include/cpython/object.h.
* Add a forward declaration of the PyObject type in pybuffer.h to fix
an inter-dependency issue.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/Python.h | 2 | ||||
-rw-r--r-- | Include/cpython/object.h | 2 | ||||
-rw-r--r-- | Include/pybuffer.h (renamed from Include/buffer.h) | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/Include/Python.h b/Include/Python.h index 5416b04..5bc8cc6 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -39,6 +39,7 @@ #include "pymacro.h" #include "pymath.h" #include "pymem.h" +#include "pybuffer.h" #include "object.h" #include "objimpl.h" #include "typeslots.h" @@ -50,7 +51,6 @@ #include "longobject.h" #include "cpython/longintrepr.h" #include "boolobject.h" -#include "buffer.h" #include "floatobject.h" #include "complexobject.h" #include "rangeobject.h" diff --git a/Include/cpython/object.h b/Include/cpython/object.h index 2ee97ba..6cc3d72 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -2,8 +2,6 @@ # error "this header file must not be included directly" #endif -#include "buffer.h" // for Py_buffer, included after PyObject has been defined - PyAPI_FUNC(void) _Py_NewReference(PyObject *op); #ifdef Py_TRACE_REFS diff --git a/Include/buffer.h b/Include/pybuffer.h index 6893505..31795b7 100644 --- a/Include/buffer.h +++ b/Include/pybuffer.h @@ -17,6 +17,10 @@ extern "C" { * */ +// Forward declaration to be able to include pybuffer.h before object.h: +// pybuffer.h uses PyObject and object.h uses Py_buffer. +typedef struct _object PyObject; + typedef struct { void *buf; PyObject *obj; /* owned reference */ |