Commit 0e6f9f32 authored by Christoph Groth's avatar Christoph Groth
Browse files

fix test_sizeof for CPython's debug mode

parent f54b3791
...@@ -415,8 +415,12 @@ def test_sizeof(): ...@@ -415,8 +415,12 @@ def test_sizeof():
n_elements += (a.ndim * machine_wordsize() + n_elements += (a.ndim * machine_wordsize() +
dtype_size[dtype] - 1) // dtype_size[dtype] dtype_size[dtype] - 1) // dtype_size[dtype]
buffer_size = n_elements * dtype_size[dtype] buffer_size = n_elements * dtype_size[dtype]
# basic Python object has 3 pointer-sized members
sizeof_should_be = buffer_size + 3 * machine_wordsize() # A Basic Python object has 3 pointer-sized members, or 5 if in
# debug mode.
debug = hasattr(sys, "gettotalrefcount")
sizeof_should_be = (buffer_size
+ machine_wordsize() * (5 if debug else 3))
assert sizeof == sizeof_should_be assert sizeof == sizeof_should_be
......
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