[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

Martin v. Löwis report at bugs.python.org
Wed Jan 5 20:40:44 CET 2011


Martin v. Löwis <martin at v.loewis.de> added the comment:

> Martin, we would like to exclude Py_buffer from the stable ABI for
> Python 3.2, until we have a chance to thrash out the missing pieces
> of the documentation for 3.3. I *think* it is a documentation
> problem, but until we're certain, it seems safer to leave it out.

Fine with me. Attached is a patch; it would be good if someone could
confirm that this exactly comprises the API that should be hidden.

----------
keywords: +patch
Added file: http://bugs.python.org/file20282/pybuffer.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10181>
_______________________________________
-------------- next part --------------
Index: Include/abstract.h
===================================================================
--- Include/abstract.h	(Revision 87765)
+++ Include/abstract.h	(Arbeitskopie)
@@ -488,6 +488,7 @@
 
     /* new buffer API */
 
+#ifndef Py_LIMITED_API
 #define PyObject_CheckBuffer(obj) \
     (((obj)->ob_type->tp_as_buffer != NULL) &&  \
      ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
@@ -575,6 +576,7 @@
 
        /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*.
     */
+#endif /* Py_LIMITED_API */
 
      PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj,
                                             PyObject *format_spec);
Index: Include/object.h
===================================================================
--- Include/object.h	(Revision 87765)
+++ Include/object.h	(Arbeitskopie)
@@ -143,7 +143,7 @@
 typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
 typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
 
-
+#ifndef Py_LIMITED_API
 /* buffer interface */
 typedef struct bufferinfo {
     void *buf;
@@ -195,6 +195,7 @@
 #define PyBUF_WRITE 0x200
 
 /* End buffer interface */
+#endif /* Py_LIMITED_API */
 
 typedef int (*objobjproc)(PyObject *, PyObject *);
 typedef int (*visitproc)(PyObject *, void *);
Index: Include/memoryobject.h
===================================================================
--- Include/memoryobject.h	(Revision 87765)
+++ Include/memoryobject.h	(Arbeitskopie)
@@ -55,9 +55,11 @@
 
 PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
 
+#ifndef Py_LIMITED_API
 PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);
     /* create new if bufptr is NULL 
         will be a new bytesobject in base */
+#endif
 
 
 /* The struct is declared here so that macros can work, but it shouldn't
Index: PC/python3.def
===================================================================
--- PC/python3.def	(Revision 87765)
+++ PC/python3.def	(Arbeitskopie)
@@ -10,13 +10,6 @@
   PyBaseObject_Type=python32.PyBaseObject_Type DATA
   PyBool_FromLong=python32.PyBool_FromLong
   PyBool_Type=python32.PyBool_Type DATA
-  PyBuffer_FillContiguousStrides=python32.PyBuffer_FillContiguousStrides
-  PyBuffer_FillInfo=python32.PyBuffer_FillInfo
-  PyBuffer_FromContiguous=python32.PyBuffer_FromContiguous
-  PyBuffer_GetPointer=python32.PyBuffer_GetPointer
-  PyBuffer_IsContiguous=python32.PyBuffer_IsContiguous
-  PyBuffer_Release=python32.PyBuffer_Release
-  PyBuffer_ToContiguous=python32.PyBuffer_ToContiguous
   PyByteArrayIter_Type=python32.PyByteArrayIter_Type DATA
   PyByteArray_AsString=python32.PyByteArray_AsString
   PyByteArray_Concat=python32.PyByteArray_Concat
@@ -317,7 +310,6 @@
   PyMem_Malloc=python32.PyMem_Malloc
   PyMem_Realloc=python32.PyMem_Realloc
   PyMemberDescr_Type=python32.PyMemberDescr_Type DATA
-  PyMemoryView_FromBuffer=python32.PyMemoryView_FromBuffer
   PyMemoryView_FromObject=python32.PyMemoryView_FromObject
   PyMemoryView_GetContiguous=python32.PyMemoryView_GetContiguous
   PyMemoryView_Type=python32.PyMemoryView_Type DATA
@@ -399,7 +391,6 @@
   PyObject_CallObject=python32.PyObject_CallObject
   PyObject_CheckReadBuffer=python32.PyObject_CheckReadBuffer
   PyObject_ClearWeakRefs=python32.PyObject_ClearWeakRefs
-  PyObject_CopyData=python32.PyObject_CopyData
   PyObject_DelItem=python32.PyObject_DelItem
   PyObject_DelItemString=python32.PyObject_DelItemString
   PyObject_Dir=python32.PyObject_Dir
@@ -412,7 +403,6 @@
   PyObject_GenericSetAttr=python32.PyObject_GenericSetAttr
   PyObject_GetAttr=python32.PyObject_GetAttr
   PyObject_GetAttrString=python32.PyObject_GetAttrString
-  PyObject_GetBuffer=python32.PyObject_GetBuffer
   PyObject_GetItem=python32.PyObject_GetItem
   PyObject_GetIter=python32.PyObject_GetIter
   PyObject_HasAttr=python32.PyObject_HasAttr


More information about the Python-bugs-list mailing list