[issue37169] test_pyobject_is_freed_free fails with 3.8.0beta1

STINNER Victor report at bugs.python.org
Thu Jun 6 11:43:05 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

I designed unit tests to be optimistic: expect that freed memory will be untouched during a few Python instructions:

# create an object, free its memory
obj = _testcapi.pyobject_freed()
# check that the object memory is freed
error = (_testcapi.pyobject_is_freed(obj) == False)

Maybe calling _testcapi.pyobject_is_freed() reuse the memory which has just been freed.

The test should be fully ritten in C to avoid this issue.

I wrote the test using 2 Python functions just to make the test simpler to write, but it seems like *sometimes*, it can fail.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37169>
_______________________________________


More information about the Python-bugs-list mailing list