]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
better PyObject_HEAD size calculation 1163/head
authorDavid Lord <davidism@gmail.com>
Sat, 29 Feb 2020 02:50:00 +0000 (18:50 -0800)
committerDavid Lord <davidism@gmail.com>
Sat, 29 Feb 2020 03:00:51 +0000 (19:00 -0800)
fixes infinite loop on Python 3.6 32-bit

CHANGES.rst
src/jinja2/debug.py

index 9635fc5588264b9276d3e389b5c53843a7b0cb50..aee6ad3a3e9193b2e542b1fe7d9b3da296a47a8c 100644 (file)
@@ -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
index d2c5a06bf6c1b17087a2663d84b2b735766f4a34..5d8aec31d05dab0b01b192b9dfe74f2656dc3077 100644 (file)
@@ -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),
         ]