Re: [Cython] Safer exception handling

2018-09-19 Thread Stefan Behnel
Robert Bradshaw schrieb am 17.09.2018 um 15:44:
> One of the pain points in Cython is that one must explicitly annotate
> non-object returning functions with except clauses. Would it be worth
> trying to change the default here, making exception-suppressing opt-in
> rather than opt-out?
> 
> There are a couple of open questions, e.g.
>   * What would the syntax be?
>   * What about extern functions?
>   * What would the performance impact be? Could it be mitigated?

One more point: what about nogil functions? They can, in theory, raise
exceptions, but they almost never do in practice.

Given that the default for return type annotations is exception propagation
(i.e. Python semantics) now, mixing that into a nogil function means that
the caller would almost always check for exceptions needlessly. And we do
not currently have a way to say "no exception return value" to get rid of
that check. That's something we'd need, especially if we change the default.

Stefan
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


[Cython] Preparing the language level change - Re: [cython-users] Cython 0.29 beta 1 released

2018-09-19 Thread Stefan Behnel
Jeroen Demeyer schrieb am 18.09.2018 um 10:23:
> On 2018-09-16 17:48, Stefan Behnel wrote:
>> * Cython now emits a warning when no ``language_level`` (2 or 3) is set
>>    explicitly
> 
> Currently, language_level=3 breaks a lot of code due to unicode_literals.
> As I mentioned a few times, it would be good to have a way to specify
> "language_level=3 except for unicode_literals". Ideally, this option should
> exist before 0.29 is released.

I can see that this would be helpful. It's unfortunate, though, that this
would introduce a temporary option that complicates the current integer
"language_level". Meaning, we'd introduce something now that we then can't
get rid of for…ever. And it seems to me like a separate directive wouldn't
solve this either because it's not really orthogonal to the language level.

Any idea?

Stefan
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Safer exception handling

2018-09-19 Thread Robert Bradshaw
On Wed, Sep 19, 2018, 5:04 PM Stefan Behnel  wrote:

> Robert Bradshaw schrieb am 17.09.2018 um 15:44:
> > One of the pain points in Cython is that one must explicitly annotate
> > non-object returning functions with except clauses. Would it be worth
> > trying to change the default here, making exception-suppressing opt-in
> > rather than opt-out?
> >
> > There are a couple of open questions, e.g.
> >   * What would the syntax be?
> >   * What about extern functions?
> >   * What would the performance impact be? Could it be mitigated?
>
> One more point: what about nogil functions? They can, in theory, raise
> exceptions, but they almost never do in practice.
>

I think feels like it should be orthogonal, I wonder what the overhead of
this check really is in practice...

Given that the default for return type annotations is exception propagation
> (i.e. Python semantics) now, mixing that into a nogil function means that
> the caller would almost always check for exceptions needlessly. And we do
> not currently have a way to say "no exception return value" to get rid of
> that check. That's something we'd need, especially if we change the
> default.
>

Yeah, that's what I meant about the syntax question.


> Stefan
> ___
> cython-devel mailing list
> cython-devel@python.org
> https://mail.python.org/mailman/listinfo/cython-devel
>
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel