[py-svn] commit/py: gutworth: use the non-hacky way of dynamically importing packages
Bitbucket
commits-noreply at bitbucket.org
Fri Apr 27 23:48:36 CEST 2012
1 new commit in py:
https://bitbucket.org/hpk42/py/changeset/8ea021239dde/
changeset: 8ea021239dde
user: gutworth
date: 2012-04-27 23:48:27
summary: use the non-hacky way of dynamically importing packages
affected #: 2 files
diff -r c332ad7033ffbd9c78b09180efef1cc60029cd23 -r 8ea021239dde14ddbc2db02771a86e0035edfbe2 py/_builtin.py
--- a/py/_builtin.py
+++ b/py/_builtin.py
@@ -231,7 +231,9 @@
assert names
for name in names:
try:
- return __import__(name, None, None, '__doc__')
+ __import__(name)
except ImportError:
excinfo = sys.exc_info()
+ else:
+ return sys.modules[name]
_reraise(*excinfo)
diff -r c332ad7033ffbd9c78b09180efef1cc60029cd23 -r 8ea021239dde14ddbc2db02771a86e0035edfbe2 py/_path/local.py
--- a/py/_path/local.py
+++ b/py/_path/local.py
@@ -517,7 +517,8 @@
if pkgpath is not None:
if ensuresyspath:
self._prependsyspath(pkgpath.dirpath())
- pkg = __import__(pkgpath.basename, None, None, [])
+ __import__(pkgpath.basename)
+ pkg = sys.modules[pkgpath.basename]
names = self.new(ext='').relto(pkgpath.dirpath())
names = names.split(self.sep)
if names and names[-1] == "__init__":
@@ -528,7 +529,8 @@
if ensuresyspath:
self._prependsyspath(self.dirpath())
modname = self.purebasename
- mod = __import__(modname, None, None, ['__doc__'])
+ __import__(modname)
+ mod = sys.modules[modname]
if self.basename == "__init__.py":
return mod # we don't check anything as we might
# we in a namespace package ... too icky to check
Repository URL: https://bitbucket.org/hpk42/py/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list