[issue38721] modulefinder should use import hooks properly

2019-11-22 Thread Dominic Littlewood
Dominic Littlewood <11dlittlew...@gmail.com> added the comment: In regards to the "unnecessary refactoring", here's a full list of what I've changed. 1. Previously, the module revolved around passing files and file descriptors around. Now, it uses specs. This means all the functions that used

[issue38721] modulefinder should use import hooks properly

2019-11-21 Thread Dominic Littlewood
Dominic Littlewood <11dlittlew...@gmail.com> added the comment: You are correct about modulefinder being static. I read "run_script" and thought it was running a script, but it turns out I was being silly. I shall correct the sys.path issue. -- ___

[issue38721] modulefinder should use import hooks properly

2019-11-21 Thread Brandt Bucher
Brandt Bucher added the comment: See prior discussion on this here: https://github.com/python/cpython/pull/11787#discussion_r256442282 -- ___ Python tracker ___ _

[issue38721] modulefinder should use import hooks properly

2019-11-21 Thread Brandt Bucher
Brandt Bucher added the comment: I'm not sure what you mean when you say "modulefinder currently will detect modules imported by a script dynamically by running the script"... modulefinder is completely static, no? I also think that changing sys.path like this is a bad idea (I tried this in

[issue38721] modulefinder should use import hooks properly

2019-11-21 Thread Dominic Littlewood
Change by Dominic Littlewood <11dlittlew...@gmail.com>: -- keywords: +patch pull_requests: +16813 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17326 ___ Python tracker

[issue38721] modulefinder should use import hooks properly

2019-11-18 Thread Dominic Littlewood
Dominic Littlewood <11dlittlew...@gmail.com> added the comment: I now have a PR which - dare I say it - appears to be working as it should. I'll just write some tests for it and then I'll send it off for review. -- ___ Python tracker

[issue38721] modulefinder should use import hooks properly

2019-11-16 Thread Dominic Littlewood
Dominic Littlewood <11dlittlew...@gmail.com> added the comment: Okay, I've encountered a snag. To use meta path finders, if the path is None, it's sometimes okay to substitute self.path, and sometimes not. The only way to make absolutely sure the finder works correctly is to change sys.path. T

[issue38721] modulefinder should use import hooks properly

2019-11-13 Thread Dominic Littlewood
Dominic Littlewood <11dlittlew...@gmail.com> added the comment: Okay, I've started putting together a proper PR, and I've had some thoughts. There's a useful script at the bottom of the importlib documentation that readers should consult. This can be used to correctly find the spec for a mod