On Sat, Dec 4, 2010 at 11:49 PM, Robert Bradshaw
<[email protected]> wrote:
> On Sat, Dec 4, 2010 at 9:25 PM, Dag Sverre Seljebotn
> <[email protected]> wrote:
>> On 12/05/2010 01:27 AM, Ondrej Certik wrote:
>>> On Sat, Dec 4, 2010 at 3:38 PM, Vitja Makarov<[email protected]>
>>> wrote:
>>>
>>>> 2010/12/4 Ondrej Certik<[email protected]>:
>>>>
>>>>> Hi,
>>>>>
>>>>> I was missing the option to tell Cython to stop on the first error. So
>>>>> I have implemented it:
>>>>>
>>>>> https://github.com/cython/cython/pull/3
>>>>>
>>>>> Ondrej
>>>>>
>>>>>
>>>> Hi!
>>>>
>>>> Is that a good idea to call sys.exit() in Errors.py maybe there is
>>>> another way to stop compilation?
>>>>
>>> Yes, that is something that I was not sure when I coded it, as I am
>>> not too familiar with Cython internals.
>>>
>>
>> The usecases are more important than the internals: Imagine for a moment
>> what this will to do pyximport, or build systems able to launch Cython
>> in-process (SCons, waf).
>
> I've made it raise the same error it does between phases to signal the
> compiler should abort.
After this "abort" change, here is how it looks like:
ond...@crow:~/repos/hermes/hermes1d/hermes1d(fix)$ make
[ 4%] Built target cython_utils
[ 8%] Built target numpy_utils
[ 93%] Built target hermes1d-debug
[ 95%] Cythonizing h1d_wrapper.pyx
Error compiling Cython file:
------------------------------------------------------------
...
prj_type = hermes1d.H1D_H1_ortho_global
else:
raise ValueError("Unknown projection type")
global _A
_A = f
hermes1d.assemble_projection_matrix_rhs(mesh.thisptr, A.thisptr,
^
------------------------------------------------------------
/home/ondrej/repos/hermes/hermes1d/hermes1d/h1d_wrapper/h1d_wrapper.pyx:369:48:
Cannot convert 'Space *' to Python object
Error compiling Cython file:
------------------------------------------------------------
...
prj_type = hermes1d.H1D_H1_ortho_global
else:
raise ValueError("Unknown projection type")
global _A
_A = f
hermes1d.assemble_projection_matrix_rhs(mesh.thisptr, A.thisptr,
^
------------------------------------------------------------
/home/ondrej/repos/hermes/hermes1d/hermes1d/h1d_wrapper/h1d_wrapper.pyx:369:48:
Compiler crash in AnalyseExpressionsTransform
ModuleNode.body = StatListNode(h1d_wrapper.pyx:6:0)
StatListNode.stats[19] = StatListNode(h1d_wrapper.pyx:358:0)
StatListNode.stats[0] = DefNode(h1d_wrapper.pyx:358:0,
modifiers = [...]/0,
name = u'assemble_projection_matrix_rhs',
num_required_args = 4,
reqd_kw_flags_cname = '0')
File 'Nodes.py', line 351, in analyse_expressions:
StatListNode(h1d_wrapper.pyx:360:4)
File 'Nodes.py', line 3346, in analyse_expressions:
ExprStatNode(h1d_wrapper.pyx:369:43)
File 'ExprNodes.py', line 322, in analyse_expressions:
SimpleCallNode(h1d_wrapper.pyx:369:43,
analysed = True,
use_managed_ref = True)
File 'ExprNodes.py', line 2865, in analyse_types:
SimpleCallNode(h1d_wrapper.pyx:369:43,
analysed = True,
use_managed_ref = True)
File 'ExprNodes.py', line 3947, in analyse_types:
TupleNode(h1d_wrapper.pyx:369:43,
is_sequence_constructor = 1,
use_managed_ref = True)
File 'ExprNodes.py', line 3742, in analyse_types:
TupleNode(h1d_wrapper.pyx:369:43,
is_sequence_constructor = 1,
use_managed_ref = True)
File 'ExprNodes.py', line 614, in coerce_to_pyobject:
AttributeNode(h1d_wrapper.pyx:369:48,
attribute = u'thisptr',
is_attribute = 1,
member = u'thisptr',
needs_none_check = True,
op = '->',
use_managed_ref = True)
File 'ExprNodes.py', line 3317, in coerce_to:
AttributeNode(h1d_wrapper.pyx:369:48,
attribute = u'thisptr',
is_attribute = 1,
member = u'thisptr',
needs_none_check = True,
op = '->',
use_managed_ref = True)
File 'ExprNodes.py', line 580, in coerce_to:
AttributeNode(h1d_wrapper.pyx:369:48,
attribute = u'thisptr',
is_attribute = 1,
member = u'thisptr',
needs_none_check = True,
op = '->',
use_managed_ref = True)
File 'ExprNodes.py', line 7076, in __init__:
CoerceToPyTypeNode(h1d_wrapper.pyx:369:48,
is_temp = 1,
use_managed_ref = True)
Compiler crash traceback from this point on:
File "/home/ondrej/usr/lib/python/Cython/Compiler/ExprNodes.py",
line 7076, in __init__
"Cannot convert '%s' to Python object" % arg.type)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Errors.py", line
151, in error
report_error(err)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Errors.py", line
143, in report_error
raise InternalError, "abort"
InternalError: Internal compiler error: abort
Traceback (most recent call last):
File "/home/ondrej/usr/bin/cython", line 8, in <module>
main(command_line = 1)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Main.py", line 773, in main
result = compile(sources, options)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Main.py", line
748, in compile
return compile_multiple(source, options)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Main.py", line
720, in compile_multiple
result = run_pipeline(source, options)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Main.py", line
585, in run_pipeline
err, enddata = context.run_pipeline(pipeline, source)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Main.py", line
231, in run_pipeline
Errors.report_error(err)
File "/home/ondrej/usr/lib/python/Cython/Compiler/Errors.py", line
143, in report_error
raise InternalError, "abort"
Cython.Compiler.Errors.InternalError: Internal compiler error: abort
make[2]: *** [hermes1d/h1d_wrapper/h1d_wrapper.cpp] Error 1
make[1]: *** [hermes1d/h1d_wrapper/CMakeFiles/h1d_wrapper.dir/all] Error 2
make: *** [all] Error 2
Now compare to the previous situation:
ond...@crow:~/repos/hermes/hermes1d/hermes1d(fix)$ make
[ 4%] Built target cython_utils
[ 8%] Built target numpy_utils
[ 93%] Built target hermes1d-debug
[ 95%] Cythonizing h1d_wrapper.pyx
Error compiling Cython file:
------------------------------------------------------------
...
prj_type = hermes1d.H1D_H1_ortho_global
else:
raise ValueError("Unknown projection type")
global _A
_A = f
hermes1d.assemble_projection_matrix_rhs(mesh.thisptr, A.thisptr,
^
------------------------------------------------------------
/home/ondrej/repos/hermes/hermes1d/hermes1d/h1d_wrapper/h1d_wrapper.pyx:369:48:
Cannot convert 'Space *' to Python object
make[2]: *** [hermes1d/h1d_wrapper/h1d_wrapper.cpp] Error 1
make[1]: *** [hermes1d/h1d_wrapper/CMakeFiles/h1d_wrapper.dir/all] Error 2
make: *** [all] Error 2
So I believe that the latter is simpler. So where should we catch the
InternalError exception? Maybe we should create a StopOnFirstError
exception, and then catch it and print "exiting the compilation due to
--fatal-errors command line switch"?
Ondrej
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev