summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hewitt <1939362+davidhewitt@users.noreply.github.com>2022-10-31 14:01:32 (GMT)
committerGitHub <noreply@github.com>2022-10-31 14:01:32 (GMT)
commite98923c0be644c474ce0e318d40e0595e4484106 (patch)
tree2567dac3a484b51f2e0fa3690ea091182efa2b89
parenta41de32942b7ac14524587a08d219f3bfe346415 (diff)
downloadcpython-e98923c0be644c474ce0e318d40e0595e4484106.zip
cpython-e98923c0be644c474ce0e318d40e0595e4484106.tar.gz
cpython-e98923c0be644c474ce0e318d40e0595e4484106.tar.bz2
gh-98410: move getbufferproc and releasebufferproc to buffer.h (#31158)
This adds them to the Limited API.
-rw-r--r--Doc/data/stable_abi.dat2
-rw-r--r--Include/cpython/object.h4
-rw-r--r--Include/pybuffer.h3
-rw-r--r--Misc/NEWS.d/next/C API/2022-10-25-17-50-43.gh-issue-98410.NSXYfm.rst1
-rw-r--r--Misc/stable_abi.toml4
5 files changed, 10 insertions, 4 deletions
diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat
index 1336584..db8fc15 100644
--- a/Doc/data/stable_abi.dat
+++ b/Doc/data/stable_abi.dat
@@ -865,6 +865,7 @@ type,descrsetfunc,3.2,,
type,destructor,3.2,,
type,getattrfunc,3.2,,
type,getattrofunc,3.2,,
+type,getbufferproc,3.12,,
type,getiterfunc,3.2,,
type,getter,3.2,,
type,hashfunc,3.2,,
@@ -875,6 +876,7 @@ type,lenfunc,3.2,,
type,newfunc,3.2,,
type,objobjargproc,3.2,,
type,objobjproc,3.2,,
+type,releasebufferproc,3.12,,
type,reprfunc,3.2,,
type,richcmpfunc,3.2,,
type,setattrfunc,3.2,,
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index 900b523..fa0cfb2 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -51,10 +51,6 @@ typedef struct _Py_Identifier {
#endif /* NEEDS_PY_IDENTIFIER */
-typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
-typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
-
-
typedef struct {
/* Number implementations must check *both*
arguments for proper type and implement the necessary conversions
diff --git a/Include/pybuffer.h b/Include/pybuffer.h
index 6893505..bbac609 100644
--- a/Include/pybuffer.h
+++ b/Include/pybuffer.h
@@ -32,6 +32,9 @@ typedef struct {
void *internal;
} Py_buffer;
+typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
+typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
+
/* Return 1 if the getbuffer function is available, otherwise return 0. */
PyAPI_FUNC(int) PyObject_CheckBuffer(PyObject *obj);
diff --git a/Misc/NEWS.d/next/C API/2022-10-25-17-50-43.gh-issue-98410.NSXYfm.rst b/Misc/NEWS.d/next/C API/2022-10-25-17-50-43.gh-issue-98410.NSXYfm.rst
new file mode 100644
index 0000000..d98bc4e
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2022-10-25-17-50-43.gh-issue-98410.NSXYfm.rst
@@ -0,0 +1 @@
+Add ``getbufferproc`` and ``releasebufferproc`` to the stable API.
diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml
index e18a6e8..0ba0f51 100644
--- a/Misc/stable_abi.toml
+++ b/Misc/stable_abi.toml
@@ -2299,3 +2299,7 @@
added = '3.12'
[macro.PY_VECTORCALL_ARGUMENTS_OFFSET]
added = '3.12'
+[typedef.getbufferproc]
+ added = '3.12'
+[typedef.releasebufferproc]
+ added = '3.12'