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 example and docs typos for objmode
context manager.
#3577
Conversation
As title. Fixes numba#3575
Codecov Report
@@ Coverage Diff @@
## master #3577 +/- ##
=======================================
Coverage 80.69% 80.69%
=======================================
Files 393 393
Lines 80425 80425
Branches 9160 9160
=======================================
Hits 64896 64896
Misses 14109 14109
Partials 1420 1420 |
numba/withcontexts.py
Outdated
|
||
@njit | ||
def foo(): | ||
x = np.arange(5) | ||
y = np.arange(5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should change it so that we allocate y = np.zeros_like(x)
and leave x
as is. We want to show that input arrays do not need to be annotated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, thanks, fixed in eacd307
numba/withcontexts.py
Outdated
with objmode(y='intp[:]'): # annotate return type | ||
# this region is executed by object-mode. | ||
y += bar(x) | ||
y += bar(y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't have to change this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in eacd307
Thanks for the review. I also note that |
Implement @sklam's suggestions.
As title.
Fixes #3575