Well, I just found three more c++ bugs. I will file them when I have
Trac access. In the meantime, I post them here before I forget about
them this week-end.

*******************************************************
* Bug#1:
*******************************************************
Compiler crash when a template argument is an undeclared object.
Compiling the following code:

"""""
from libcpp.vector cimport vector
cdef vector[x] *vect
"""""

crash the compiler with the following traceback:

"""""
Traceback (most recent call last):
  File "/usr/local/bin/cython", line 8, in <module>
    main(command_line = 1)
  File "/home/toki/install/cython-devel/Cython/Compiler/Main.py", line
776, in main
    result = compile(sources, options)
  File "/home/toki/install/cython-devel/Cython/Compiler/Main.py", line
751, in compile
    return compile_multiple(source, options)
  File "/home/toki/install/cython-devel/Cython/Compiler/Main.py", line
723, in compile_multiple
    result = run_pipeline(source, options)
  File "/home/toki/install/cython-devel/Cython/Compiler/Main.py", line
593, in run_pipeline
    err, enddata = context.run_pipeline(pipeline, source)
  File "/home/toki/install/cython-devel/Cython/Compiler/Main.py", line
234, in run_pipeline
    data = phase(data)
  File "/home/toki/install/cython-devel/Cython/Compiler/ParseTreeTransforms.py",
line 965, in __call__
    return super(AnalyseDeclarationsTransform, self).__call__(root)
  File "/home/toki/install/cython-devel/Cython/Compiler/Visitor.py",
line 276, in __call__
    return super(CythonTransform, self).__call__(node)
  File "/home/toki/install/cython-devel/Cython/Compiler/Visitor.py",
line 259, in __call__
    return self.visit(root)
  File "/home/toki/install/cython-devel/Cython/Compiler/Visitor.py",
line 28, in visit
    return handler_method(obj)
  File "/home/toki/install/cython-devel/Cython/Compiler/ParseTreeTransforms.py",
line 973, in visit_ModuleNode
    node.analyse_declarations(self.env_stack[-1])
  File "/home/toki/install/cython-devel/Cython/Compiler/ModuleNode.py",
line 63, in analyse_declarations
    self.body.analyse_declarations(env)
  File "/home/toki/install/cython-devel/Cython/Compiler/Nodes.py",
line 341, in analyse_declarations
    stat.analyse_declarations(env)
  File "/home/toki/install/cython-devel/Cython/Compiler/Nodes.py",
line 911, in analyse_declarations
    base_type = self.base_type.analyse(env)
  File "/home/toki/install/cython-devel/Cython/Compiler/Nodes.py",
line 836, in analyse
    self.type = base_type.specialize_here(self.pos, template_types)
  File "/home/toki/install/cython-devel/Cython/Compiler/PyrexTypes.py",
line 1924, in specialize_here
    return self.specialize(dict(zip(self.templates, template_values)))
  File "/home/toki/install/cython-devel/Cython/Compiler/PyrexTypes.py",
line 1940, in specialize
    specialized.scope = self.scope.specialize(values)
  File "/home/toki/install/cython-devel/Cython/Compiler/Symtab.py",
line 1605, in specialize
    entry.cname)
  File "/home/toki/install/cython-devel/Cython/Compiler/Symtab.py",
line 350, in declare_type
    entry = self.declare(name, cname, type, pos, visibility)
  File "/home/toki/install/cython-devel/Cython/Compiler/Symtab.py",
line 306, in declare
    if type.is_buffer and not isinstance(self, LocalScope):
AttributeError: 'NoneType' object has no attribute 'is_buffer'
""""""


*************************************************
* Bug#2:
**************************************************
operator[] doesn't return the right type.
If cppclass Foo contain the declaration: "T operator[](int)",  and foo
is an instance of Foo, foo[4] is thought by cython to be of type Foo
(instead of T) .
For example:

"""""
from libcpp.vector cimport vector

cdef vector[int] *vect=new vector[int]()
vect.push_back(5)
vect.push_back(6)
print vect[0]
"""""

gives the following error:

"""""
print vect[0]
         ^
/home/toki/progs/cython13tests/bug1.pyx:6:10: Cannot convert
'vector<int>' to Python object
"""""

****************************************************
* Bug#3:
****************************************************
cython.operator.dereference and functions returning a reference are
not recognized as l-values.

For example, the following code:
"""""
cimport cython.operator.dereference
from libcpp.vector cimport vector

cdef vector[int] *vect=new vector[int]()
vect.push_back(5)
vect.push_back(6)
cdef vector[int].iterator iter=vect.begin()
cython.operator.dereference(iter)=8
""""""
gives the following error:

""""""
cython.operator.dereference(iter)=5
                          ^
/home/toki/progs/cython13tests/bug2.pyx:8:27: Cannot assign to or delete this
""""""

In the same way, replacing the last line by: "vect.at(0)=5" gives:

""""""
vect.at(0)=5
      ^
/home/toki/progs/cython13tests/bug2.pyx:7:7: Cannot assign to or delete this
""""""

While  " *iter=5 " and " vect.at(0)=5 " ares valid C++ code.

*************************************************************

That will be all for today :-)
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to