Andrew Svetlov schrieb am 13.06.2015 um 08:30: > I have an issue in aiohttp library: > https://github.com/KeepSafe/aiohttp/issues/410 > > 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.
Thanks for the report, I can reproduce it with this code: ''' def genexpr_in_except(x, result): """ >>> result = [] >>> try: genexpr_in_except([1, 2, 3], result) ... except ValueError: print("OK") ... else: print("NOT RAISED!") OK >>> result [2, 4, 6] >>> result = [] >>> genexpr_in_except([], result) >>> result [] """ try: if x: raise ValueError() except ValueError: assert sys.exc_info()[0] is ValueError, 1 result[:] = list(i*2 for i in x) assert sys.exc_info()[0] is ValueError, 2 raise ''' The "raise" at the end actually works, but the second "assert" makes it fail. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel