mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
GH-78724: Initialize struct.Struct in __new__ (GH-94532)
Closes https://github.com/python/cpython/issues/75960 Closes https://github.com/python/cpython/issues/78724
This commit is contained in:
parent
f5f047aa62
commit
c8c0afc713
4 changed files with 49 additions and 41 deletions
|
@ -700,6 +700,20 @@ class StructTest(unittest.TestCase):
|
|||
with self.assertRaises(TypeError):
|
||||
cls.x = 1
|
||||
|
||||
@support.cpython_only
|
||||
def test__struct_Struct__new__initialized(self):
|
||||
# See https://github.com/python/cpython/issues/78724
|
||||
|
||||
s = struct.Struct.__new__(struct.Struct, "b")
|
||||
s.unpack_from(b"abcd")
|
||||
|
||||
@support.cpython_only
|
||||
def test__struct_Struct_subclassing(self):
|
||||
class Bob(struct.Struct):
|
||||
pass
|
||||
|
||||
s = Bob("b")
|
||||
s.unpack_from(b"abcd")
|
||||
|
||||
def test_issue35714(self):
|
||||
# Embedded null characters should not be allowed in format strings.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue