mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-45459: Add Py_buffer to limited API (GH-29991)
- [x] ``Py_buffer`` struct - [x] ``PyBuffer_*()`` API functions - [x] ``PyBUF_*`` constants - [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots - [x] ``PyMemoryView_FromBuffer()`` API - [x] tests for limited API - [x] ``make regen-limited-abi`` - [x] documentation update - [ ] export ``PyPickleBuffer*()`` API ???
This commit is contained in:
parent
08f8301b21
commit
f66c857572
17 changed files with 308 additions and 131 deletions
|
@ -28,6 +28,14 @@ SYMBOL_NAMES = (
|
|||
"PyBaseObject_Type",
|
||||
"PyBool_FromLong",
|
||||
"PyBool_Type",
|
||||
"PyBuffer_FillContiguousStrides",
|
||||
"PyBuffer_FillInfo",
|
||||
"PyBuffer_FromContiguous",
|
||||
"PyBuffer_GetPointer",
|
||||
"PyBuffer_IsContiguous",
|
||||
"PyBuffer_Release",
|
||||
"PyBuffer_SizeFromFormat",
|
||||
"PyBuffer_ToContiguous",
|
||||
"PyByteArrayIter_Type",
|
||||
"PyByteArray_AsString",
|
||||
"PyByteArray_Concat",
|
||||
|
@ -381,6 +389,7 @@ SYMBOL_NAMES = (
|
|||
"PyMemberDescr_Type",
|
||||
"PyMember_GetOne",
|
||||
"PyMember_SetOne",
|
||||
"PyMemoryView_FromBuffer",
|
||||
"PyMemoryView_FromMemory",
|
||||
"PyMemoryView_FromObject",
|
||||
"PyMemoryView_GetContiguous",
|
||||
|
@ -470,8 +479,10 @@ SYMBOL_NAMES = (
|
|||
"PyObject_CallNoArgs",
|
||||
"PyObject_CallObject",
|
||||
"PyObject_Calloc",
|
||||
"PyObject_CheckBuffer",
|
||||
"PyObject_CheckReadBuffer",
|
||||
"PyObject_ClearWeakRefs",
|
||||
"PyObject_CopyData",
|
||||
"PyObject_DelItem",
|
||||
"PyObject_DelItemString",
|
||||
"PyObject_Dir",
|
||||
|
@ -489,6 +500,7 @@ SYMBOL_NAMES = (
|
|||
"PyObject_GetAIter",
|
||||
"PyObject_GetAttr",
|
||||
"PyObject_GetAttrString",
|
||||
"PyObject_GetBuffer",
|
||||
"PyObject_GetItem",
|
||||
"PyObject_GetIter",
|
||||
"PyObject_HasAttr",
|
||||
|
|
|
@ -58,6 +58,17 @@ class TestXXLimited(CommonTests, unittest.TestCase):
|
|||
with self.assertRaises(self.module.Error):
|
||||
raise self.module.Error
|
||||
|
||||
def test_buffer(self):
|
||||
xxo = self.module.Xxo()
|
||||
self.assertEqual(xxo.x_exports, 0)
|
||||
b1 = memoryview(xxo)
|
||||
self.assertEqual(xxo.x_exports, 1)
|
||||
b2 = memoryview(xxo)
|
||||
self.assertEqual(xxo.x_exports, 2)
|
||||
b1[0] = 1
|
||||
self.assertEqual(b1[0], 1)
|
||||
self.assertEqual(b2[0], 1)
|
||||
|
||||
|
||||
class TestXXLimited35(CommonTests, unittest.TestCase):
|
||||
module = xxlimited_35
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue