mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-38076: Make struct module PEP-384 compatible (#15805)
* PEP-384 _struct * More PEP-384 fixes for _struct Summary: Add a couple of more fixes for `_struct` that were previously missed such as removing `tp_*` accessors and using `PyBytesWriter` instead of calling `PyBytes_FromStringAndSize` with `NULL`. Also added a test to confirm that `iter_unpack` type is still uninstantiable. * 📜🤖 Added by blurb_it.
This commit is contained in:
parent
43c9731334
commit
4f384af067
3 changed files with 180 additions and 150 deletions
|
@ -679,6 +679,10 @@ class UnpackIteratorTest(unittest.TestCase):
|
|||
with self.assertRaises(struct.error):
|
||||
s.iter_unpack(b"12")
|
||||
|
||||
def test_uninstantiable(self):
|
||||
iter_unpack_type = type(struct.Struct(">ibcp").iter_unpack(b""))
|
||||
self.assertRaises(TypeError, iter_unpack_type)
|
||||
|
||||
def test_iterate(self):
|
||||
s = struct.Struct('>IB')
|
||||
b = bytes(range(1, 16))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue