[Cython] Bug report: building an extension with --pyrex-gdb fails

Lars Buitinck L.J.Buitinck at uva.nl
Sat Dec 17 13:16:00 CET 2011


Hello all,

I was trying to build a C++ extension with debugging support as
described in http://docs.cython.org/src/userguide/debugging.html, but
I got an error from the Cython compiler:


lars at schoothond:~/src/sortedcollections$ python setup.py build_ext
--inplace --pyrex-gdb
running build_ext
cythoning sortedcollections/set.pyx to sortedcollections/set.cpp
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    language="c++")]
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py",
line 125, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib/python2.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py",
line 132, in build_extensions
    ext.sources = self.cython_sources(ext.sources, ext)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py",
line 275, in cython_sources
    full_module_name=module_name)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Main.py",
line 625, in compile
    return compile_single(source, options, full_module_name)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Main.py",
line 570, in compile_single
    return run_pipeline(source, options, full_module_name)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Main.py",
line 462, in run_pipeline
    err, enddata = Pipeline.run_pipeline(pipeline, source)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Pipeline.py",
line 313, in run_pipeline
    data = phase(data)
  File "Visitor.py", line 276, in
Cython.Compiler.Visitor.CythonTransform.__call__
(Cython/Compiler/Visitor.c:5173)
  File "Visitor.py", line 259, in
Cython.Compiler.Visitor.VisitorTransform.__call__
(Cython/Compiler/Visitor.c:4917)
  File "Visitor.py", line 165, in
Cython.Compiler.Visitor.TreeVisitor._visit
(Cython/Compiler/Visitor.c:3401)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/ParseTreeTransforms.py",
line 2613, in visit_ModuleNode
    self.visit_FuncDefNode(nested_funcdef)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/ParseTreeTransforms.py",
line 2660, in visit_FuncDefNode
    self.tb.start('Function', attrs=attrs)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Debugger/DebugWriter.py",
line 52, in start
    self.tb.start(name, attrs or {})
  File "saxparser.pxi", line 398, in lxml.etree.TreeBuilder.start
(src/lxml/lxml.etree.c:83668)
  File "saxparser.pxi", line 430, in
lxml.etree.TreeBuilder._handleSaxStart (src/lxml/lxml.etree.c:84030)
  File "apihelpers.pxi", line 224, in lxml.etree._makeSubElement
(src/lxml/lxml.etree.c:12831)
  File "apihelpers.pxi", line 219, in lxml.etree._makeSubElement
(src/lxml/lxml.etree.c:12756)
  File "apihelpers.pxi", line 299, in lxml.etree._initNodeAttributes
(src/lxml/lxml.etree.c:13615)
  File "apihelpers.pxi", line 1364, in lxml.etree._utf8
(src/lxml/lxml.etree.c:22190)
TypeError: Argument must be bytes or unicode, got 'NoneType'


My setup.py is :


from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

setup(
    cmdclass = {'build_ext': build_ext},
    ext_modules = [Extension("sortedcollections.set",
                             ["sortedcollections/set.pyx"],
                             language="c++")]
)


Importing Extension from Cython.Distutils.extension and adding
pyrex_gdb=True to the Extension gives the same error.

Regards,

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam


More information about the cython-devel mailing list