Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
update_refs: Assertion `_PyGCHead_REFS(gc) != 0' failed when running test_logging_undefined() of tests/test_api.py #1050
Python does crash when running Jinja2 test suite on a Python compiled in debug mode and Jinja2 version 2.10.1:
I get the same crash on Python 3.7, 3.8 and master branch (future 3.9).
According to gdb, the invalid object is a traceback object:
First, I reported the bug to pytest: pytest-dev/pytest#5766
But I managed to write a reproducer which doesn't use pytest nor jinja2, by copying jinja2 into my reproducer script. My reproducer only has 4 imports:
I'm now pretty sure that the bug is around "def _init_ugly_crap():" which uses ctypes. The code seems to be written for CPython in release mode.
I'm not sure how to attach a .py file to a GitHub issue, so I uploaded it at: http://haypo.alwaysdata.net/tmp/jinja_test_api.py
Maybe the root issue is around this code of tb_set_next():
I'm not a ctypes expert. Another attempt to fix the bug:
I'm not sure about
But using my PR #1051 is better, Python implements sanity checks. For example, Python detects cycles.