[issue37521] importlib examples have their exec_module()/sys.modules assignment lines reversed

2019-07-17 Thread Benjamin Mintz
Benjamin Mintz added the comment: ``` name = 'testext' spec = importlib.util.find_spec(name) print(name in sys.modules) module = importlib.util.module_from_spec(spec) print(name in sys.modules) spec.loader.exec_module(module) print(name in sys.modules) ``` This prints False, False, True

[issue37521] importlib examples have their exec_module()/sys.modules assignment lines reversed

2019-07-16 Thread Benjamin Mintz
Benjamin Mintz added the comment: I dunno, one of those three does. I suppose it's spec.loader.exec_module(). -- ___ Python tracker <https://bugs.python.org/issue37

[issue37521] importlib examples have their exec_module()/sys.modules assignment lines reversed

2019-07-13 Thread Benjamin Mintz
Benjamin Mintz added the comment: Hmm, why is the assignment to sys.modules necessary at all, if module_from_spec() always does so? -- ___ Python tracker <https://bugs.python.org/issue37

[issue37521] importlib.util.module_from_spec return value is not the same as in sys.modules

2019-07-09 Thread Benjamin Mintz
Benjamin Mintz added the comment: Updated. Also removed some old code which had irrelevant imports that I thought I removed already. The expected and actual output remain the same. -- Added file: https://bugs.python.org/file48463/importlib-util-module-from-spec-stale-reference.zip

[issue37521] importlib.util.module_from_spec return value is not the same as in sys.modules

2019-07-07 Thread Benjamin Mintz
Benjamin Mintz added the comment: Updated main.py. New expected output: True New actual output: == False Traceback (most recent call last): File "main.py", line 14, in print(module.sub) AttributeError: module 'testext' has no attr

[issue37521] importlib.util.module_from_spec return value is not the same as in sys.modules

2019-07-07 Thread Benjamin Mintz
New submission from Benjamin Mintz : unzip the attached zip file and run main.py expected output: True actual output: False So what? If you follow these directions, https://docs.python.org/3.7/library/importlib.html#checking-if-a-module-can-be-imported , you will put a stale reference

[issue34635] inspect: add tools for inspecting subclasses

2018-09-13 Thread Benjamin Mintz
Change by Benjamin Mintz : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue34635> ___ ___ Pyth

[issue34635] inspect: add tools for inspecting subclasses

2018-09-13 Thread Benjamin Mintz
Benjamin Mintz added the comment: I didn't have one in mind. I just noticed that there was a getmro which accessed __mro__ but no corresponding method for __subclasses__. That got me getsubclasses and getallsubclasses. Then I thought it would be cool if you could walk the tree of subclasses

[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Benjamin Mintz
Change by Benjamin Mintz : -- keywords: +patch pull_requests: +8623 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34635> ___ ___ Py

[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Benjamin Mintz
New submission from Benjamin Mintz : Adds inspect.getsubclasses, inspect.getallsubclasses (recursive), and inspect.getsubclasstree (recursive, maintains structure). See documentation for more details. -- components: Library (Lib) messages: 325068 nosy: bmintz priority: normal