Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #8903. NumbaDeprecationWarnings raised from @{gu,}vectorize. #8909

Merged
merged 2 commits into from
Apr 24, 2023

Conversation

stuartarchibald
Copy link
Contributor

This adds localised suppressions for NumbaDeprecationWarnings that would have been raised from the code path for @{gu,}vectorize due to Numba's internal use of @jit() with the nopython kwarg not present.

This is considered acceptable due to the following: Deprecation warnings from Numba's internal use of its own API should not be visible to users. Unfortunately there's no trivial programmatic way to work around the internal use of @jit-with-no-kwargs in this case as numerous code paths go through the same operations and user code may well be relying on "object mode" fall-back. What this patch does it makes it so that users will not see NumbaDeprecationWarnings for this internal use. However, if a user defines a @{gu,}vectorize function that ends up using the fall-back to the object mode pipeline during compilation, Numba will continue to raise numerous loud warnings about this happening which should provide a hint as to the problem and how to fix it.

Numerous tests have been added to check combinations of kwargs/use of default kwargs being passed through to @{gu,}vectorize. These tests make sure that there are no additional NumbaDeprecationWarnings raised to do with Numba's internal use of @jit() in @{gu,}vectorize where the nopython kwarg is not supplied.

Closes #8903

…ze`.

This adds localised suppressions for `NumbaDeprecationWarning`s that
would have been raised from the code path for `@{gu,}vectorize` due to
Numba's internal use of `@jit()` with the `nopython` kwarg not present.

This is considered acceptable due to the following: Deprecation warnings
from Numba's internal use of its own API should not be visible to users.
Unfortunately there's no trivial programmatic way to work around the
internal use of `@jit`-with-no-kwargs in this case as numerous code
paths go through the same operations and user code may well be relying on
"object mode" fall-back. What this patch does it makes it so that users will
not see `NumbaDeprecationWarning`s for this internal use. However, if a
user defines a `@{gu,}vectorize` function that ends up using the fall-back
to the object mode pipeline during compilation, Numba will continue to raise
numerous loud warnings about this happening which should provide a hint as
to the problem and how to fix it.

Numerous tests have been added to check combinations of kwargs/use of
default kwargs being passed through to `@{gu,}vectorize`. These tests
make sure that there are no additional `NumbaDeprecationWarning`s
raised to do with Numba's internal use of `@jit()` in `@{gu,}vectorize`
where the `nopython` kwarg is not supplied.

Closes numba#8903
@stuartarchibald
Copy link
Contributor Author

Note that 0d1969a fixes flake8 and also fixes an issue picked up in CI where the pycc deprecation tests need setuptools to run, but there's no guarantee of it being present, so the tests are now conditionally skipped.

@stuartarchibald stuartarchibald marked this pull request as ready for review April 19, 2023 16:34
Copy link
Member

@sklam sklam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good and I have manually verified that the warning is suppressed expectedly in various situations.

@sklam sklam added 5 - Ready to merge Review and testing done, is ready to merge and removed 3 - Ready for Review labels Apr 24, 2023
@sklam sklam merged commit d44573b into numba:main Apr 24, 2023
21 checks passed
sklam added a commit to sklam/numba that referenced this pull request Apr 25, 2023
Fix numba#8903. `NumbaDeprecationWarning`s raised from `@{gu,}vectorize`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to merge Review and testing done, is ready to merge Effort - medium Medium size effort needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0.57.0rc1 NumbaDeprecationWarning: @guvectorize even with nopython keyword argument
2 participants