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() which skips all the extra setup that __import__ 
entails and which is unnecessary for programmatic imports).

The docs for importlib.import_module() clearly state it uses 
importlib.__import__, but I'm not sure if anyone would be surprised if they 
replaced builtins.__import__ and found that importlib.import_module() was doing 
an end-run around their custom import system, especially since we are promoting 
importlib.import_module() over calling builtins.__import__ directly.

----------
components: Library (Lib)
messages: 196144
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: importlib.import_module() bypasses builtins.__import__
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18831>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to