A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cython/cython/issues/5586 below:

[BUG] Exception specifications on fused functions are too general · Issue #5586 · cython/cython · GitHub

Describe the bug

Cython seems to use except * for fused functions rather than the more sensible except -1? (or similar) that the specialized type would imply.

Code to reproduce the behaviour:
cimport cython

cpdef cython.numeric f(cython.numeric x):
    return x

def test_f_double(double x):
    return f(x)

def test_f_int(int x):
    return f(x)

The generated C code is:

__pyx_t_1 = __pyx_fuse_4__pyx_f_13fused_rettype_f(__pyx_v_x, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 7, __pyx_L1_error)

and

__pyx_t_1 = __pyx_fuse_1__pyx_f_13fused_rettype_f(__pyx_v_x, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L1_error)

i.e. it misses the cheap if (__pyx_t_1 == -1) call that it should be inserting.

Expected behaviour

The fused functions should pick up the default error return value of their specializations.

OS

Linux

Python version

3.11

Cython version

3.0.0

Additional context

Related to #5564 - that issue specifically involves Scipy fused functions that are a lot more costly in a nogil block than they should be because of this (but that issue is mainly about a deadlock).

I'd like to get this into 3.0.1 if possible.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4