Skip to content

Commit f09d7c7

Browse files
committed
Register imported CLI sub-namespaces in sys.modules
1 parent 5c92781 commit f09d7c7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/core/IronPython/Runtime/Importer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ private static object ImportModuleFrom(CodeContext/*!*/ context, object from, Ar
127127
string name = parts.Array[parts.Offset + parts.Count - 1];
128128
if (from is NamespaceTracker ns) {
129129
if (ns.TryGetValue(name, out object val)) {
130-
return MemberTrackerToPython(context, val);
130+
object ret = MemberTrackerToPython(context, val);
131+
if (ret != null && val is NamespaceTracker retns && !context.LanguageContext.SystemStateModules.ContainsKey(retns.Name)) {
132+
context.LanguageContext.SystemStateModules[retns.Name] = ret;
133+
}
134+
return ret;
131135
}
132136
}
133137

0 commit comments

Comments
 (0)