summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-09-28 20:41:39 (GMT)
committerBrett Cannon <brett@python.org>2012-09-28 20:41:39 (GMT)
commit8ed677db129171317b8ee7cd45b39b9013f5a2d6 (patch)
tree432e16dcdc3767b247b42db2ca9e3ceee4d3f355 /Lib
parent7dcbd2c8733af3ce5b075604fc41502568d6267e (diff)
downloadcpython-8ed677db129171317b8ee7cd45b39b9013f5a2d6.zip
cpython-8ed677db129171317b8ee7cd45b39b9013f5a2d6.tar.gz
cpython-8ed677db129171317b8ee7cd45b39b9013f5a2d6.tar.bz2
Add some comments.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_bootstrap.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 224b4dc..98361a7 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1669,7 +1669,11 @@ def __import__(name, globals=None, locals=None, fromlist=(), level=0):
elif not name:
return module
else:
+ # Figure out where to slice the module's name up to the first dot
+ # in 'name'.
cut_off = len(name) - len(name.partition('.')[0])
+ # Slice end needs to be positive to alleviate need to special-case
+ # when ``'.' not in name``.
return sys.modules[module.__name__[:len(module.__name__)-cut_off]]
else:
return _handle_fromlist(module, fromlist, _gcd_import)