Ticket #512 (new defect)

Opened 5 months ago

Last modified 2 weeks ago

parser bug for mismatches in function arguments with default value

Reported by: robertwb Owned by: somebody
Priority: major Milestone: 0.14
Component: Parsing Keywords:
Cc:

Description (last modified by scoder) (diff)

On Mar 3, 2010, at 7:13 PM, Toni Moll wrote:

Hello,

this is a bug report for cython 0.12.1. The bug occurs when an
function argument with default value is named differently in
the .pyx and the .pxd file.
A minimal example is:

foo.pyx contains:
===========================
cpdef test(test=5):
    pass
===========================

foo.pxd contains:
===========================
cpdef test(FJKHFKLJDHF=*)
===========================

the traceback is:

/tmp/Cython-0.12.1$ python2.5 cython.py foo.pyx 
Traceback (most recent call last):
  File "cython.py", line 8, in <module>
    main(command_line = 1)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Main.py", line 743, in main
    result = compile(sources, options)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Main.py", line 718, in compile
    return compile_multiple(source, options)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Main.py", line 690, in compile_multiple
    result = run_pipeline(source, options)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Main.py", line 561, in run_pipeline
    err, enddata = context.run_pipeline(pipeline, source)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Main.py", line 221, in run_pipeline
    data = phase(data)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Main.py", line 154, in generate_pyx_code
    module_node.process_implementation(options, result)
  File "/tmp/Cython-0.12.1/Cython/Compiler/ModuleNode.py", line 72, in process_implementation
    self.generate_c_code(env, options, result)
  File "/tmp/Cython-0.12.1/Cython/Compiler/ModuleNode.py", line 274, in generate_c_code
    self.body.generate_function_definitions(env, code)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Nodes.py", line 341, in generate_function_definitions
    stat.generate_function_definitions(env, code)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Nodes.py", line 1106, in generate_function_definitions
    self.generate_argument_parsing_code(env, code)
  File "/tmp/Cython-0.12.1/Cython/Compiler/Nodes.py", line 1493, in generate_argument_parsing_code
    code.putln('%s = %s->%s;' % (arg.cname, Naming.optional_args_cname, self.type.opt_arg_cname(declarator.name)))
  File "/tmp/Cython-0.12.1/Cython/Compiler/PyrexTypes.py", line 1571, in opt_arg_cname
    return self.op_arg_struct.base_type.scope.lookup(arg_name).cname
AttributeError: 'NoneType' object has no attribute 'cname'

best regards and thanks a lot for cython, I like it a lot!
Toni
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Change History

Changed 5 months ago by scoder

  • description modified (diff)

Changed 2 weeks ago by robertwb

  • milestone changed from 0.13 to 0.14

Will be easier to resolve after the function refactoring.

Note: See TracTickets for help on using tickets.