cython: [BUG] Undesirable performance warnings

Describe the bug

The upgrade to Cython 3.0.3 on the Apache Arrow CI suddenly produces a lot of similar warnings when compiling our Cython files. Example:

  [1/129] Compiling Cython CXX source for _compute...
  performance hint: pyarrow/_compute.pyx:380:39: Exception check will always require the GIL to be acquired. Possible solutions:
        1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.

https://github.com/apache/arrow/actions/runs/6452131883/job/17513702248#step:6:3712

The warning is legitimate in itself (that is, the analysis is right), it’s just that it produces no actual value for us, and we get hundreds of instances of this warning simply because it flags a very common and convenient construct in the Arrow Cython source code (that construct unpacks a C++ result-or-error type and raises a Python exception on error).

Several complaints here:

  1. I skimmed through the docs and I haven’t found how to disable the warning (in particular, it does not seem mentioned here). It should be possible to disable warnings selectively, because they otherwise can obscure other more important pieces of information.

  2. I also find weird that the warning message seems to introduce several “Possible solutions” but only one is displayed. Is the message truncated?

Code to reproduce the behaviour:

No response

Expected behaviour

No response

OS

No response

Python version

No response

Cython version

3.0.3

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 16 (15 by maintainers)

Commits related to this issue

Most upvoted comments