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

numpy calls interfere with external code in nopython=True functions #3906

Closed
cosama opened this issue Mar 27, 2019 · 4 comments
Closed

numpy calls interfere with external code in nopython=True functions #3906

cosama opened this issue Mar 27, 2019 · 4 comments
Labels
no action required No action was needed to resolve.

Comments

@cosama
Copy link

cosama commented Mar 27, 2019

System

  • conda python 3.7 with:
    • llvmlite 0.27.0-py37hd408876_0 --> 0.28.0-py37hd408876_0
    • numba 0.42.0-py37h962f231_0 --> 0.43.0-py37h962f231_0
  • Tested on Fedora and Ubuntu 18.04

Minimal example

import numba
import numpy as np


@numba.jit(nopython=False)
def cross_issue(a=None):
    if a is None:
        a = 1
    np.sum([1, 2, 3])
    return a


print(cross_issue())

Expected result

  • after the if statement a should be 1, however the function returns None.
  • The behavior doesn't show up if the call to np.sum is removed. The weird behavior is also present with other functions (I originally discovered it with np.cross and saw it with np.mean too).
  • I have honestly no idea how this even can be or how to debug it. Suggestions are welcome.
@cosama cosama changed the title numpy calls interfere with external code in nopython=True functions numpy calls interfere with external code in nopython=True functions Mar 27, 2019
@cosama cosama changed the title numpy calls interfere with external code in nopython=True functions numpy calls interfer with external code in nopython=True functions Mar 27, 2019
@cosama cosama changed the title numpy calls interfer with external code in nopython=True functions numpy calls interfere with external code in nopython=True functions Mar 27, 2019
@cosama
Copy link
Author

cosama commented Mar 27, 2019

I forgot to mention, the above code works fine in numba 0.42.0 and 0.41.0.

@stuartarchibald
Copy link
Contributor

Thanks for the report. What you are seeing is most likely due to this bug: #3879 which was fixed here: #3883, the recently released Numba 0.43.1 fixes this problem, perhaps try updating your Numba installation:

conda install numba=0.43.1

@cosama
Copy link
Author

cosama commented Mar 27, 2019

Yeah 0.43.1 fixed this. Sorry didn't find the other issue. I will close this then.

@cosama cosama closed this as completed Mar 27, 2019
@stuartarchibald
Copy link
Contributor

@cosama great, thanks for confirming.

@stuartarchibald stuartarchibald added no action required No action was needed to resolve. and removed needtriage labels Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no action required No action was needed to resolve.
Projects
None yet
Development

No branches or pull requests

2 participants