[Cython] Bug: comprehensions clear current exception

Andrew Svetlov andrew.svetlov at gmail.com
Sat Jun 13 08:30:30 CEST 2015

I have an issue in aiohttp library:

The source of problem is: when I execute the following code

body = ', '.join("'{}': {!r}".format(k, v) for k, v in self.items())

in except block Cython clears exception.

Changing from comprehension to regular iteration works well:

lst = []
for k, v in self._items:
    lst.append("'{}': {!r}".format(k, v))
body = ', '.join(lst)

In pyre Python both versions don't clear current exception.

I think it's a Cython bug.

Andrew Svetlov

More information about the cython-devel mailing list