diff options
author | David Lord <davidism@gmail.com> | 2020-02-28 18:50:00 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-02-28 19:00:51 -0800 |
commit | 40e70b820c8279396ae7cb075042456a7d1ac313 (patch) | |
tree | 331cf354714f24f17cd2a54ff9e8a5a93ec73741 | |
parent | eccf9a00a0dd809418dd4814515d78ac1759e2fe (diff) | |
download | jinja-40e70b820c8279396ae7cb075042456a7d1ac313.tar.gz |
better PyObject_HEAD size calculation
fixes infinite loop on Python 3.6 32-bit
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | src/jinja2/debug.py | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 9635fc55..aee6ad3a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,8 @@ Unreleased :func:`contextfunction`. :issue:`1145` - Update ``wordcount`` filter to trigger :class:`Undefined` methods by wrapping the input in :func:`soft_unicode`. :pr:`1160` +- Fix a hang when displaying tracebacks on Python 32-bit. + :issue:`1162` Version 2.11.1 diff --git a/src/jinja2/debug.py b/src/jinja2/debug.py index d2c5a06b..5d8aec31 100644 --- a/src/jinja2/debug.py +++ b/src/jinja2/debug.py @@ -245,10 +245,7 @@ else: class _CTraceback(ctypes.Structure): _fields_ = [ # Extra PyObject slots when compiled with Py_TRACE_REFS. - ( - "PyObject_HEAD", - ctypes.c_byte * (32 if hasattr(sys, "getobjects") else 16), - ), + ("PyObject_HEAD", ctypes.c_byte * object().__sizeof__()), # Only care about tb_next as an object, not a traceback. ("tb_next", ctypes.py_object), ] |