diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 3809f2d2643895..530bd8f65d7461 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -424,6 +424,16 @@ def test_705836(self): self.assertRaises(OverflowError, struct.pack, "Zf", big_real) + self.assertRaises(OverflowError, struct.pack, "Zf", big_imag) + self.assertRaises(OverflowError, struct.pack, "StructError, "required argument is not a complex"); return -1; } - memcpy(p, &x, sizeof(x)); - return 0; + + int ret = PyFloat_Pack4(c.real, p, PY_LITTLE_ENDIAN); + + if (ret) { + return ret; + } + return PyFloat_Pack4(c.imag, p + sizeof(float), PY_LITTLE_ENDIAN); } static int