summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_capi.py
diff options
context:
space:
mode:
authorscoder <stefan_ml@behnel.de>2020-06-06 19:35:10 (GMT)
committerGitHub <noreply@github.com>2020-06-06 19:35:10 (GMT)
commitf7c4e236429606e1c982cacf24e10fc86ef4462f (patch)
treed54aa7bc07169ac0a7c472d72d44e10b9dd16b3a /Lib/test/test_capi.py
parent68874a8502da440a1dc4746cf73262648b870aee (diff)
downloadcpython-f7c4e236429606e1c982cacf24e10fc86ef4462f.zip
cpython-f7c4e236429606e1c982cacf24e10fc86ef4462f.tar.gz
cpython-f7c4e236429606e1c982cacf24e10fc86ef4462f.tar.bz2
bpo-40724: Support setting buffer slots from type specs (GH-20648)
This is not part of the limited API but makes the buffer slots available for type specs.
Diffstat (limited to 'Lib/test/test_capi.py')
-rw-r--r--Lib/test/test_capi.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 5b8b9f6..73e167a 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -477,6 +477,11 @@ class CAPITest(unittest.TestCase):
self.assertEqual(ref(), inst)
self.assertEqual(inst.weakreflist, ref)
+ def test_heaptype_with_buffer(self):
+ inst = _testcapi.HeapCTypeWithBuffer()
+ b = bytes(inst)
+ self.assertEqual(b, b"1234")
+
def test_c_subclass_of_heap_ctype_with_tpdealloc_decrefs_once(self):
subclass_instance = _testcapi.HeapCTypeSubclass()
type_refcnt = sys.getrefcount(_testcapi.HeapCTypeSubclass)