[New-bugs-announce] [issue10391] obj2ast's error handling can lead to python crashing with a C-level assertion failure
report at bugs.python.org
Thu Nov 11 21:53:43 CET 2010
New submission from Dave Malcolm <dmalcolm at redhat.com>:
In various places within the generated Python/Python-ast.c, error handling generates a repr() and raises exceptions accordingly.
Currently in py3k the generated code uses PyBytes_AS_STRING() on the repr. My understanding is that repr() should be a PyUnicodeObject, not a PyBytesObject. This seems to be unchanged from r63682, which was a mass-change of PyString to PyBytes from 2 years ago.
This leads to a python crashing with an assertion failure:
test_compile_ast (__main__.TestSpecifics) ... python: Python/Python-ast.c:5835: obj2ast_expr: Assertion `((((((PyObject*)(tmp))->ob_type))->tp_flags & ((1L<<27))) != 0)' failed.
when invoking compile() on certain (malformed) trees of ast objects.
components: Interpreter Core
title: obj2ast's error handling can lead to python crashing with a C-level assertion failure
versions: Python 3.1, Python 3.2, Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce