[Jython-checkins] jython: No longer set subpackages to None in sys.modules. Fixes #2472

darjus.loktevic jython-checkins at python.org
Tue Feb 23 19:14:46 EST 2016


https://hg.python.org/jython/rev/f66401888fc5
changeset:   7906:f66401888fc5
user:        Darjus Loktevic <darjus at gmail.com>
date:        Wed Feb 24 11:14:39 2016 +1100
summary:
  No longer set subpackages to None in sys.modules. Fixes #2472

files:
  src/org/python/core/imp.java |  6 ------
  1 files changed, 0 insertions(+), 6 deletions(-)


diff --git a/src/org/python/core/imp.java b/src/org/python/core/imp.java
--- a/src/org/python/core/imp.java
+++ b/src/org/python/core/imp.java
@@ -939,12 +939,6 @@
         StringBuilder parentNameBuffer = new StringBuilder(pkgMod != null ? pkgName : "");
         PyObject topMod = import_next(pkgMod, parentNameBuffer, firstName, name, fromlist);
         if (topMod == Py.None || topMod == null) {
-            // Add None to sys.modules for submodule or subpackage names that aren't found, but
-            // leave top-level entries out. This allows them to be tried again if another
-            // import attempt is made after they've been added to sys.path.
-            if (topMod == null && pkgMod != null) {
-                modules.__setitem__(parentNameBuffer.toString().intern(), Py.None);
-            }
             parentNameBuffer = new StringBuilder("");
             // could throw ImportError
             if (level > 0) {

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list