[Cython] Bug: comprehensions clear current exception

2015-06-13 Thread Andrew Svetlov
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.

I think it's a Cython bug.

-- 
Thanks,
Andrew Svetlov
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Bug: comprehensions clear current exception

2015-06-16 Thread Andrew Svetlov
I saw the same behavior for eating current exception not only for
comprehensions but for iterating over generator with yield's (both
iterating code and generator was in Cython).

On Tue, Jun 16, 2015 at 6:53 PM, Stefan Behnel  wrote:
> 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



-- 
Thanks,
Andrew Svetlov
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.25 beta

2016-10-11 Thread Andrew Svetlov
https://github.com/cython/cython/issues/1461 is still an issue.

On Tue, Oct 11, 2016 at 4:22 AM Joshua  wrote:

>
>
> On Monday, October 10, 2016 at 3:51:37 PM UTC-4, Robert Bradshaw wrote:
>
> Thanks for all of those to tested the alpha release. I think we've managed
> to fix all the issues and regressions raised in that thread; here's a beta
> that's likely to turn into a release candidate.
>
> https://github.com/cython/cython/archive/0.25b0.zip
>
>
> Hi Robert,
>
> I just wanted to report that I continue to get the same error reported in
> the following issue in this release:
> https://github.com/cython/cython/issues/1466
>
> Thanks,
> Josh
> ___
> cython-devel mailing list
> cython-devel@python.org
> https://mail.python.org/mailman/listinfo/cython-devel
>
-- 
Thanks,
Andrew Svetlov
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.25 beta

2016-10-11 Thread Andrew Svetlov
https://github.com/cython/cython/issues/1461 is still an issue.

On Monday, October 10, 2016 at 10:51:37 PM UTC+3, Robert Bradshaw wrote:
>
> Thanks for all of those to tested the alpha release. I think we've managed 
> to fix all the issues and regressions raised in that thread; here's a beta 
> that's likely to turn into a release candidate. 
>
> https://github.com/cython/cython/archive/0.25b0.zip
>
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel