[issue18831] importlib.import_module() bypasses builtins.__import__

2020-03-06 Thread Brett Cannon
Brett Cannon added the comment: I'm calling it and saying people are not expecting these semantics. -- resolution: -> not a bug stage: test needed -> resolved status: open -> closed ___ Python tracker

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-31 Thread Brett Cannon
Brett Cannon added the comment: builtins.__import__ and importlib.__import__ are different objects. This isn't about whether this is whole situation is a bug per-se, but whether users expect that overriding builtins.__import__ will affect all import-related code in the stdlib and if that's

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-31 Thread Terry J. Reedy
Terry J. Reedy added the comment: Adding something like '(not builtins.__import__)' or '(different from builtins.__import__') after 'importlib.__import__' should reduce the possibility of confusing the two and expecting something that will not happen. You might check the doc for

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-31 Thread Brett Cannon
Brett Cannon added the comment: help(__import__) doesn't mention anything about overriding the function. I already touched up the stdlib docs for builtins.__import__ to strongly advise you don't override the function. As for overriding importlib.__import__, it won't do anything; the code for

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-31 Thread Terry J. Reedy
Terry J. Reedy added the comment: Looking at the actual doc: importlib.__import__(name, globals=None, locals=None, fromlist=(), level=0) An implementation of the built-in __import__() function. I think this is pretty clear that builtin.__import__ has no effect unless directly called.

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-30 Thread Terry J. Reedy
Terry J. Reedy added the comment: The discrepancy between doc and code should be eliminated. In this case, it seems the doc should be changed (in 3.3 as well). Would 'not' in the right place suffice? -- nosy: +terry.reedy ___ Python tracker

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-30 Thread Brett Cannon
Brett Cannon added the comment: Not sure what doc discrepancy you are talking about, Terry. The docs for importlib are totally accurate which means no one has been accidentally mislead by them. This bug is about whether importlib.import_module() bypassing builtins.__import__ is a big enough

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-30 Thread Terry J. Reedy
Terry J. Reedy added the comment: Perhaps I am confused because I did not notice the switch between builtins.__import__ and importlib.__import__ -- and I do not know the relation between the two, if indeed they are two and not one. What I read and understood is * importlib.import_module doc

[issue18831] importlib.import_module() bypasses builtins.__import__

2013-08-25 Thread Brett Cannon
New submission from Brett Cannon: Not sure if anyone really cares about this (I don't, but I figured I should at least let it be known), but I realized that importlib.import_module() bypasses builtins.__import__ by calling directly into the innards of importlib (specifically _gcd_import()