New submission from Dave Malcolm <dmalc...@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
messages: 120967
nosy: dmalcolm
priority: normal
severity: normal
status: open
title: obj2ast's error handling can lead to python crashing with a C-level 
assertion failure
type: crash
versions: Python 3.1, Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10391>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to