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

Should resolve ImportError on run time, not compile time #63

Open
alanjds opened this issue Aug 21, 2018 · 1 comment
Open

Should resolve ImportError on run time, not compile time #63

alanjds opened this issue Aug 21, 2018 · 1 comment
Labels
imported Imported from google/grumpy

Comments

@alanjds
Copy link

alanjds commented Aug 21, 2018

google#397 opened by @alanjds on Feb 26

Let be this test code:

import sys
import math

assert sys.modules['math']
assert 'fake_not_existing_module' not in sys.modules

sys.modules['fake_not_existing_module'] = math
assert sys.modules['fake_not_existing_module']

import fake_not_existing_module
assert fake_not_existing_module

It is valid and works on CPython, but Grumpy will raise:

...
  File "/Users/alanjds/src/git/grumpy/build/lib/python2.7/site-packages/grumpy/compiler/imputil.py", line 158, in _resolve_import
    raise util.ImportError(node, 'no such module: {}'.format(modname))
grumpy.compiler.util.ImportError: line 116: no such module: fake_not_existing_module

To me, seems that compile-time import errors should be ignored and be checked/raised only on run time.

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by alanjds
Tuesday Feb 27, 2018 at 00:54 GMT


I am planning a refactor on the "tools" folder of Grumpy, to address this, google#388, to implement the PEP-3147 and more.

@alanjds alanjds added the imported Imported from google/grumpy label Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Imported from google/grumpy
Projects
None yet
Development

No branches or pull requests

1 participant