Hi again,
Stefan Behnel wrote:
> Robert Bradshaw wrote:
>> It would be really useful to have a mode/mechanism to get the
>> position of the code when an error like this occurs. I can think of
>> several ways to do it, but all would significantly impact speed.
>
> Yes, I thought about that, too, a couple of times already. The stack traces
> are not very helpful, what you'd need is a dump of the syntax tree nodes
> that are along the trace path.
>
> We could do that by catching all exceptions in Main.py, collecting all
> objects that belong to method calls in the stack trace, and dumping all
> that inherit from Node.
I implemented this. Here's an example of a compiler crash while compiling
Visitor.py, that I triggered by explicitly raising an exception somewhere
in the compiler code.
That should make future compiler crashes a lot easier to track down.
Stefan
Compiling module Cython.Compiler.Visitor ...
Error converting Pyrex file to C:
------------------------------------------------------------
...
cdef class BasicVisitor:
cdef dict dispatch_table
cpdef visit(self, obj)
cdef class TreeVisitor(BasicVisitor):
cdef public list access_path
^
------------------------------------------------------------
/home/sbehnel/source/Python/cython/cython-work/Cython/Compiler/Visitor.pxd:6:21:
Compiler crash in AnalyseExpressionsTransform
ModuleNode.body = StatListNode(Visitor.pxd:1:0,
is_literal = 0,
is_name = 0)
StatListNode.stats[1] = CClassDefNode(Visitor.pxd:5:5,
api = 0,
as_name = u'TreeVisitor',
base_class_module = '',
base_class_name = u'BasicVisitor',
class_name = u'TreeVisitor',
in_pxd = True,
is_literal = 0,
is_name = 0,
module_name = '',
typedef_flag = 0,
visibility = 'private')
CClassDefNode.body = StatListNode(Visitor.pxd:6:4,
is_literal = 0,
is_name = 0)
StatListNode.stats[0] = StatListNode(Visitor.pxd:6:9,
is_literal = 0,
is_name = 0)
StatListNode.stats[0] = PropertyNode(Visitor.pxd:6:21,
is_literal = 0,
is_name = 0,
name = u'access_path')
PropertyNode.body = StatListNode(Visitor.pxd:6:21,
is_literal = 0,
is_name = 0)
StatListNode.stats[0] = DefNode(Visitor.pxd:6:21,
is_literal = 0,
is_name = 0,
is_wrapper = 0,
name = u'__get__',
needs_closure = False,
num_kwonly_args = 0,
num_required_args = 1,
num_required_kw_args = 0,
pxd_locals = [...],
reqd_kw_flags_cname = '0')
File 'Nodes.py', line 3314, in analyse_expressions:
ReturnStatNode(Visitor.pxd:6:21,
is_literal = 0,
is_name = 0,
temps_in_use = [...])
File 'ExprNodes.py', line 2633, in analyse_types:
AttributeNode(Visitor.pxd:6:21,
attribute = u'access_path',
is_attribute = 1,
is_called = 0,
is_literal = 0,
is_name = 0,
is_py_attr = 0,
is_sequence_constructor = 0,
is_target = 0,
is_temp = 0,
member = u'access_path',
needs_none_check = True,
op = '->')
File 'ExprNodes.py', line 2715, in analyse_as_ordinary_attribute:
AttributeNode(Visitor.pxd:6:21,
attribute = u'access_path',
is_attribute = 1,
is_called = 0,
is_literal = 0,
is_name = 0,
is_py_attr = 0,
is_sequence_constructor = 0,
is_target = 0,
is_temp = 0,
member = u'access_path',
needs_none_check = True,
op = '->')
File 'ExprNodes.py', line 2729, in analyse_attribute:
AttributeNode(Visitor.pxd:6:21,
attribute = u'access_path',
is_attribute = 1,
is_called = 0,
is_literal = 0,
is_name = 0,
is_py_attr = 0,
is_sequence_constructor = 0,
is_target = 0,
is_temp = 0,
member = u'access_path',
needs_none_check = True,
op = '->')
Compiler crash traceback from this point on:
File
"/home/sbehnel/source/Python/cython/cython-work/Cython/Compiler/ExprNodes.py",
line 2743, in analyse_attribute
raise InternalError(None)
InternalError: Internal compiler error: None
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev