bpo-40724: Support setting buffer slots from type specs (GH-20648) (GH-20683)

This is not part of the limited API but makes the buffer slots available for type specs.
(cherry picked from commit f7c4e236429606e1c982cacf24e10fc86ef4462f)
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index aad9239..a9e051d 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -476,6 +476,11 @@
         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)