I am trying to rewrite some code and have troubles with the following code:

        cdef str s = self.name
        if s:
            s += ' '
        s += self.opening_delimiter
        cdef list E = list('{!r}'.format(self.get(n))
                           for n in xrange(min(num_elts, self.preview)))
        if num_elts >= self.preview:
            # PROBLEM/BUG with the following code line
            # (run doctests of this file to see)
            E.append(self.more)   # <<<<<<<<<<<<<<< here
        s += self.separator.join(E)
        s += self.closing_delimiter
        return s

With the marked line, many doctests fail; like this:

Failed example:
    m2
Expected:
    lazy list [8, 10, 12, ...]
Got:
    <repr(<sage.data_structures.lazy_list.lazy_list_abstract at
0x7f684d746d40>) failed: TypeError: unsupported operand type(s) for +=:
'NoneType' and 'NoneType'>

Any ideas what goes wrong? (I've debugged now for over one hour and have
no glue (but I am no Cython expert)).
I've also tried without the "cdef str" and "cdef list" above. The
strings self.* are defined in the corresponding .pxd

A branch with the code is on trac: u/dkrenn/cython-str-problem-append
file sage/data_structures/lazy_list.pyx, method __repr__, line 502

Best Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to