Commit 2570b55e authored by Stefan Behnel's avatar Stefan Behnel

Fix pure Python struct test in Py<3.6 where keyword dicts are unordered. This...

Fix pure Python struct test in Py<3.6 where keyword dicts are unordered. This means that cython.struct(x=int, y=float) has a non-deterministic order.
parent b5a546a9
......@@ -150,7 +150,11 @@ def test_struct(n, x):
a = cython.declare(MyStruct3)
a[0] = MyStruct(is_integral=True, data=MyUnion(n=n))
a[1] = MyStruct(is_integral=False, data={'x': x})
if sys.version_info >= (3, 6):
# dict is ordered => struct creation via keyword arguments above was deterministic!
a[2] = MyStruct(False, MyUnion(x=x))
else:
a[2] = MyStruct(is_integral=False, data=MyUnion(x=x))
return a[0].data.n, a[1].data.x, a[2].is_integral
import cython as cy
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment