[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 a

[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 th

[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 <https://bugs.python.or

[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 sy

[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 th

[issue38722] runpy should use io.open_code() instead of open()

2019-11-06 Thread Dominic Littlewood
New submission from Dominic Littlewood <11dlittlew...@gmail.com>: Fairly obviously, if you're using something called runpy you're probably trying to run some code. To do this it has to open the script as a file. This is similar to two other issues I'm posting, but they're in dif

[issue38723] Pdb._runscript should use io.open_code() instead of open()

2019-11-06 Thread Dominic Littlewood
New submission from Dominic Littlewood <11dlittlew...@gmail.com>: Fairly obviously, if you're using something called _runscript you're probably trying to run some code. To do this it has to open the script as a file. This is similar to two other issues I'm posting, but they're in dif

[issue38723] Pdb._runscript should use io.open_code() instead of open()

2019-11-06 Thread Dominic Littlewood
Change by Dominic Littlewood <11dlittlew...@gmail.com>: -- components: +Library (Lib) type: -> security versions: +Python 3.9 ___ Python tracker <https://bugs.python.or

[issue38721] modulefinder should use io.open_code() instead of open()

2019-11-06 Thread Dominic Littlewood
New submission from Dominic Littlewood <11dlittlew...@gmail.com>: modulefinder currently will detect modules imported by a script dynamically by running the script, and to do this it has to open the script as a file. This would also fix what appears to be a bug where modulefinder

[issue38297] Imports at top of module is often not used

2019-10-01 Thread Dominic Littlewood
Dominic Littlewood <11dlittlew...@gmail.com> added the comment: With all due respect, I disagree with what you're saying here. "It's a bit misleading to use the stdlib as a guideline" ... when looking at the style guide for the stdlib? I appreciate that PEP 8 is used fo

[issue38297] Imports at top of module is often not used

2019-09-28 Thread Dominic Littlewood
Dominic Littlewood <11dlittlew...@gmail.com> added the comment: I've slightly adjusted the script to check for module-level imports not at the top of the file. If we permit things like this: if condition: import module else: do_something_sensible() as long as they are at t

[issue38297] Imports at top of module is often not used

2019-09-27 Thread Dominic Littlewood
New submission from Dominic Littlewood <11dlittlew...@gmail.com>: In PEP 8, it is stated that: "Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants." Note the word "always". This

[issue37953] Fix ForwardRef equality checks

2019-08-28 Thread Dominic Littlewood
Change by Dominic Littlewood <11dlittlew...@gmail.com>: -- keywords: +patch pull_requests: +15235 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15400 ___ Python tracker <https://bugs.python.or

[issue37953] Fix ForwardRef equality checks

2019-08-26 Thread Dominic Littlewood
New submission from Dominic Littlewood <11dlittlew...@gmail.com>: Apologies for issuing a pull request without an associated issue. I'm kind of new to this. Nevermind, I'm making one now. The typing module currently contains a bug where ForwardRefs change their hash and equalit