Ticket #286 (closed defect: fixed)
error parsing .pxd with derived class
| Reported by: | rmurri | Owned by: | robertwb |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.11.3 |
| Component: | Error Reporting | Keywords: | |
| Cc: |
Description
I cannot get Cython 0.11.1 to compile the following simple example::
$ cat a.pxd
cdef class A(object)
cdef class B(A)
$ cat a.pyx
cdef class A(object):
pass
cdef class B(A):
pass
$ cat c.pyx
from a cimport B
cdef class C(B):
pass
File "a.pyx" compiles correctly, but Cython chokes on "c.pxd"::
$ cython -v a.pyx c.pyx
Compiling /tmp/a.pyx
Compiling /tmp/c.pyx
Traceback (most recent call last):
File "/home/rmurri/sw/Cython-0.11.1/bin/cython", line 8, in <module>
main(command_line = 1)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/Main.py", line 734, in main
result = compile(sources, options)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/Main.py", line 711, in compile
return compile_multiple(source, options)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/Main.py", line 681, in compile_multiple
result = run_pipeline(source, options)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/Main.py", line 543, in run_pipeline
err, enddata = context.run_pipeline(pipeline, source)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/Main.py", line 198, in run_pipeline
data = phase(data)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/Main.py", line 139, in generate_pyx_code
module_node.process_implementation(options, result)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/ModuleNode.py", line 71, in process_implementation
self.generate_c_code(env, options, result)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/ModuleNode.py", line 269, in generate_c_code
self.generate_typeobj_definitions(env, code)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/ModuleNode.py", line 825, in generate_typeobj_definitions
self.generate_new_function(scope, code)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/ModuleNode.py", line 885, in generate_new_function
tp_new = TypeSlots.get_base_slot_function(scope, tp_slot)
File "/home/rmurri/sw/Cython-0.11.1/Cython/Compiler/TypeSlots.py", line 429, in get_base_slot_function
if scope.parent_scope is base_type.scope.parent_scope:
AttributeError: 'NoneType' object has no attribute 'parent_scope'
$ cython --version
Cython version 0.11.1
Same error if I change "class A(object)" to "class A".
However, Cython compiles correcly if ": pass" is added to class prototypes in "a.pxd".
Change History
Note: See
TracTickets for help on using
tickets.
