Regression in cythonize?

90 views
Skip to first unread message

Björn Dahlgren

unread,
Jul 19, 2016, 5:56:19 AM7/19/16
to cython-users
Hi all,

For a particular cython source file of mine, with python3.4 cythonize works in Cython 0.23.4,
but fails with 0.24.1 with the exception "AttributeError: 'str' object has no attribute 'is_unicode'"

the pyx observing this is found here.

Here is the full traceback:

$ python3 setup.py build_ext -i
Compiling symcxx/_symcxx.pyx because it changed.
[1/1] Cythonizing symcxx/_symcxx.pyx
Traceback (most recent call last):
  File "setup.py", line 69, in <module>
    gdb_debug=True)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Build/Dependencies.py", line 915, in cythonize
    cythonize_one(*args)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Build/Dependencies.py", line 1020, in cythonize_one
    result = compile([pyx_file], options)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Main.py", line 690, in compile
    return compile_multiple(source, options)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Main.py", line 668, in compile_multiple
    result = run_pipeline(source, options, context=context)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Main.py", line 495, in run_pipeline
    err, enddata = Pipeline.run_pipeline(pipeline, source)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Pipeline.py", line 365, in run_pipeline
    data = phase(data)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Pipeline.py", line 53, in generate_pyx_code_stage
    module_node.process_implementation(options, result)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/ModuleNode.py", line 131, in process_implementation
    self.generate_c_code(env, options, result)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/ModuleNode.py", line 359, in generate_c_code
    self.body.generate_function_definitions(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 435, in generate_function_definitions
    stat.generate_function_definitions(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 435, in generate_function_definitions
    stat.generate_function_definitions(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 4636, in generate_function_definitions
    self.body.generate_function_definitions(self.scope, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 435, in generate_function_definitions
    stat.generate_function_definitions(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 4670, in generate_function_definitions
    self.body.generate_function_definitions(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 435, in generate_function_definitions
    stat.generate_function_definitions(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 3996, in generate_function_definitions
    super(GeneratorDefNode, self).generate_function_definitions(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 3067, in generate_function_definitions
    FuncDefNode.generate_function_definitions(self, env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 1944, in generate_function_definitions
    self.generate_function_body(env, code)
  File "/home/bjorn/.local/lib/python3.4/site-packages/Cython/Compiler/Nodes.py", line 3970, in generate_function_body
    name = code.intern_identifier(self.name)
  File "Cython/Compiler/Code.py", line 1660, in Cython.Compiler.Code.CCodeWriter.intern_identifier (/tmp/pip-5rdu1az9-build/Cython/Compiler/Code.c:43105)
  File "Cython/Compiler/Code.py", line 1650, in Cython.Compiler.Code.CCodeWriter.get_py_string_const (/tmp/pip-5rdu1az9-build/Cython/Compiler/Code.c:42698)
  File "Cython/Compiler/Code.py", line 1183, in Cython.Compiler.Code.GlobalState.get_py_string_const (/tmp/pip-5rdu1az9-build/Cython/Compiler/Code.c:30502)
  File "Cython/Compiler/Code.py", line 1154, in Cython.Compiler.Code.GlobalState.get_string_const (/tmp/pip-5rdu1az9-build/Cython/Compiler/Code.c:29615)
AttributeError: 'str' object has no attribute 'is_unicode'

Best regards,
Björn Dahlgren

Robert Bradshaw

unread,
Jul 20, 2016, 2:53:17 AM7/20/16
to cython...@googlegroups.com
Thanks for the report! Do you think you could come up with a minimal example?
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "cython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cython-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Björn Dahlgren

unread,
Jul 30, 2016, 3:26:36 AM7/30/16
to cython-users


On Wednesday, 20 July 2016 08:53:17 UTC+2, Robert Bradshaw wrote:
Thanks for the report! Do you think you could come up with a minimal example?

Sure, I should have invested the time to start with, sorry about that.
It seems to be the combination of @property and a generator which is causing this,
here is a minimal example:
cdef class MyClass(object):
   
@property
   
def flat(self):
       
yield 42

Best regards,
Björn

Reply all
Reply to author
Forward
0 new messages