Ticket #52 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

internal compiler error if first argument of cpdef method has type "int"

Reported by: cwitty Owned by: somebody
Priority: major Milestone: 0.9.8.1
Component: Code Generation Keywords:
Cc:

Description

The following (invalid) code:

cdef class Foo:
    cpdef foo(int i):
        return None

gives this error message:

Error converting Pyrex file to C:
------------------------------------------------------------
...
cdef class Foo:
    cpdef foo(int i):
         ^
------------------------------------------------------------

/tmp/foo.pyx:2:10: Self argument of C method does not match parent type
Traceback (most recent call last):
  File "/usr/bin/cython", line 8, in <module>
    main(command_line = 1)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Main.py", line 527, in main
    result = compile(sources, options)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Main.py", line 505, in compile
    return compile_multiple(source, options)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Main.py", line 472, in compile_multiple
    result = context.compile(source, options)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Main.py", line 327, in compile
    tree.process_implementation(scope, options, result)
  File "/var/lib/python-support/python2.5/Cython/Compiler/ModuleNode.py", line 59, in process_implementation
    self.generate_c_code(env, options, result)
  File "/var/lib/python-support/python2.5/Cython/Compiler/ModuleNode.py", line 243, in generate_c_code
    self.body.generate_function_definitions(env, code, options.transforms)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Nodes.py", line 2051, in generate_function_definitions
    self.entry.type.scope, code, transforms)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Nodes.py", line 928, in generate_function_definitions
    self.py_func.generate_function_definitions(env, code, transforms)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Nodes.py", line 820, in generate_function_definitions
    self.body.analyse_expressions(lenv)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Nodes.py", line 2601, in analyse_expressions
    self.value.allocate_temps(env)
  File "/var/lib/python-support/python2.5/Cython/Compiler/ExprNodes.py", line 347, in allocate_temps
    self.release_subexpr_temps(env)
  File "/var/lib/python-support/python2.5/Cython/Compiler/ExprNodes.py", line 412, in release_subexpr_temps
    node.release_temp(env)
  File "/var/lib/python-support/python2.5/Cython/Compiler/ExprNodes.py", line 403, in release_temp
    env.release_temp(self.result_code)
  File "/var/lib/python-support/python2.5/Cython/Compiler/Symtab.py", line 585, in release_temp
    % cname)
Cython.Compiler.Errors.InternalError: Internal compiler error: Temporary variable __pyx_2 released more than once

This is probably another instance of the sort of problem described recently on the Cython mailing list in the thread "Errors and pipelines", where Cython reports an error and then crashes later because something is internally inconsistent after the first error.

I didn't even notice the first, correct error,

/tmp/foo.pyx:2:10: Self argument of C method does not match parent type

until I was in the process of constructing this bug report.

Change History

Changed 5 years ago by robertwb

  • status changed from new to closed
  • resolution set to fixed

OK, I've fixed this.

Changed 5 years ago by robertwb

  • milestone set to 0.9.8.1
Note: See TracTickets for help on using tickets.