mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13881)
This commit is contained in:
parent
554450fb4e
commit
0690c79c41
2 changed files with 16 additions and 1 deletions
|
|
@ -208,6 +208,21 @@ class ArrayTestCase(unittest.TestCase):
|
|||
_type_ = c_int
|
||||
_length_ = 0
|
||||
|
||||
def test_empty_element_struct(self):
|
||||
class EmptyStruct(Structure):
|
||||
_fields_ = []
|
||||
|
||||
obj = (EmptyStruct * 2)() # bpo37188: Floating point exception
|
||||
assert sizeof(obj) == 0
|
||||
|
||||
def test_empty_element_array(self):
|
||||
class EmptyArray(Array):
|
||||
_type_ = c_int
|
||||
_length_ = 0
|
||||
|
||||
obj = (EmptyArray * 2)() # bpo37188: Floating point exception
|
||||
assert sizeof(obj) == 0
|
||||
|
||||
def test_bpo36504_signed_int_overflow(self):
|
||||
# The overflow check in PyCArrayType_new() could cause signed integer
|
||||
# overflow.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue