[Pyrex] Fwd: crash

Robert Bradshaw robertwb at math.washington.edu
Sun Oct 21 10:10:42 CEST 2007


This looks like a Pyrex bug as well as a Cython bug. It is invalid  
code, but should probably throw an error on parsing rather than crash.

- Robert


Begin forwarded message:

> From: Craig Citro <craigcitro at gmail.com>
> Date: October 20, 2007 5:03:16 PM PDT
> To: Robert Bradshaw <robertwb at math.washington.edu>
> Subject: cython crash
>
> robert -- here's the crash:
>
>
> Building sage/libs/pari/gen.c because it depends on sage/libs/pari/ 
> gen.pyx.
> cython --embed-positions --incref-local-binop -I/sage/devel/sage- 
> convert -o sage/libs/pari/gen.c sage/libs/pari/gen.pyx
> Traceback (most recent call last):
>   File "/sage/local/bin/cython", line 8, in <module>
>     main(command_line = 1)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Main.py", line 305, in main
>     result = context.compile(source, options)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Main.py", line 189, in compile
>     tree.process_implementation(scope, result)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> ModuleNode.py", line 38, in process_implementation
>     self.generate_c_code(env, result)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> ModuleNode.py", line 132, in generate_c_code
>     self.body.generate_function_definitions(env, code)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Nodes.py", line 156, in generate_function_definitions
>     stat.generate_function_definitions(env, code)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Nodes.py", line 1522, in generate_function_definitions
>     self.entry.type.scope, code)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Nodes.py", line 156, in generate_function_definitions
>     stat.generate_function_definitions(env, code)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Nodes.py", line 566, in generate_function_definitions
>     self.body.analyse_declarations(lenv)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Nodes.py", line 146, in analyse_declarations
>     stat.analyse_declarations(env)
>   File "/sage/local/lib/python2.5/site-packages/Cython/Compiler/ 
> Nodes.py", line 2725, in analyse_declarations
>     module_scope = env.find_module(self.module_name, self.pos)
> AttributeError: LocalScope instance has no attribute 'find_module'
>
>
> and here's the line that caused it:
>
>     def __call__(self, s):
>         """
>         Create the PARI object obtained by evaluating s using PARI.
>         """
>         cdef pari_sp prev_avma
>         global avma
>
>         from sage.rings.integer cimport Integer ## <------- this is  
> the culprit
>
>         prev_avma = avma
>
>         if isinstance(s, gen):
>             return s
>         elif PY_TYPE_CHECK(s, Integer):
>             return 0




More information about the Pyrex mailing list