-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
BUG: import full module path in npy_load_module #8148
Conversation
Use the full module path when importing importlib.machinery for use in the npy_load_module function. Just importing importlib is not sufficient in certain cases, for example Python 3.4. closes numpy#8147
Change looks good but can we get a test? |
Was thinking about the following as a test: def test_npy_load_module_py34():
with tempdir(prefix="numpy_test_compat_") as folder:
filename = join(folder, 'example.py')
with open(filename, 'w') as f:
f.write("magic_number = 42")
example = npy_load_module('example', filename)
assert_(example.magic_number == 42) The issue is that this passes with or without the proposed fix. Outside of the test suite the assert will fail without the fix but inside the test suite it always passes. |
Fun,
I'm at a loss on how write a test that changes from pass to fail with the proposed modification. |
Ugh, wow. Hail mary: Or if it's not doable we can skip it. |
@njsmith I'm going to put this in, figuring out how to test it looks to be more trouble than it is worth. |
Thanks @jjhelmus . |
Would this be backported to 1.11? |
Use the full module path when importing importlib.machinery for use in the
npy_load_module function. Just importing importlib is not sufficient in certain
cases, for example Python 3.4.
closes #8147