-
Notifications
You must be signed in to change notification settings - Fork 46
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
How to bypass mypyc when importing #1034
Comments
Isn't this more of a question for the python interpreter? What should mypyc be doing at the point where cpython already attempted to load a .so, to make it load a .py instead? |
It is, I’m just asking if there’s a blessed way to do it. I tried temporarily modifying AssertionError: Where do you come from? and I’m completely stumped why. def import_from_python(mod_name: str) -> ModuleType:
assert mod_name not in sys.modules
meta_path = sys.meta_path.copy()
sys.meta_path[:] = [
loader
for loader in meta_path
if getattr(loader, "__name__", None) != "ExtensionFileLoader"
]
try:
spec = find_spec(mod_name)
assert spec
assert type(spec.loader).__name__ != "ExtensionFileLoader", "Where do you come from?"
return import_module(mod_name)
finally:
sys.meta_path[:] = meta_path |
Again, that sounds like a question for the CPython repository? |
The actual issue is “interpreted classes cannot inherit from compiled”, which comes from mypyc. I’m asking here to get an answer about the best way to deal with that. I assume that way is “import everything from the Python files somehow”, but I’m not sure. |
I want to import a module from its sources to avoid
How can I skip the .so files and do that?
The text was updated successfully, but these errors were encountered: