-
Notifications
You must be signed in to change notification settings - Fork 792
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 ._orig
access for submodules for MF extensions
#1174
Conversation
This addresses an issue where submodules like `mymodule._orig.submodule` would not load properly. This will properly load things like `from .foofa import xyz` from a module or sub-module in the original location but currently does not work if the import path is absolute.
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.
Not an expert with the inner working of the Python import system, so learnt a lot from the PR. :)
the PR looks good to me.
The one thing I wonder is if the changes merit some additional tests. You think it is worth adding some? Would be happy to have a stab at adding some, if you think it is worthwhile.
Yep. I think tests would be nice. THere are some unit tests that test the extension mechanism. We can just add an extension that overrides something simple and see if we can access _orig. Would you be able to do that? Happy to provide pointers. And don't feel obligated, if you don't have time, I can do it too :). |
Yeah, would be very happy to have a go at it :) I'll have a crack at it next week. |
OK, so I've had a go at adding a test case. I picked the most innocuous looking module to extend. The attempt is here, if you want to have a look - #1192. Still waiting for the tests to start in CI, but I checked the One thing I wasn't sure about, will the |
Testing[291] @ 4665d5a |
Testing[291] @ 204f823 |
Testing[291] @ 204f823 PASSED |
This addresses an issue where submodules like
mymodule._orig.submodule
would not load properly.This will properly load things like
from .foofa import xyz
from a module or sub-module in the original location but currently does not work if the import path is absolute.