Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/core/IronPython/Runtime/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ private static object ImportModuleFrom(CodeContext/*!*/ context, object from, Ar
string name = parts.Array[parts.Offset + parts.Count - 1];
if (from is NamespaceTracker ns) {
if (ns.TryGetValue(name, out object val)) {
return MemberTrackerToPython(context, val);
object ret = MemberTrackerToPython(context, val);
if (ret != null && val is NamespaceTracker retns && !context.LanguageContext.SystemStateModules.ContainsKey(retns.Name)) {
context.LanguageContext.SystemStateModules[retns.Name] = ret;
}
return ret;
}
}

Expand Down
13 changes: 8 additions & 5 deletions tests/suite/test_cliclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,11 +1199,14 @@ def test_serialization(self):
System.StringSplitOptions.RemoveEmptyEntries,
]

if False:
# TODO: Enum types are not picklable if defined in nested namespaces
# https://github.com/IronLanguages/ironpython3/issues/1989
clr.AddReference("System.Text.Json")
data.append(System.Text.Json.JsonValueKind.Object) # byte-based enum
if is_cli:
# enum types
clr.AddReference("Microsoft.Scripting")
import Microsoft.Scripting
data.append(Microsoft.Scripting.Severity.Warning) # different namespace than System
if is_netcoreapp:
clr.AddReference("System.Text.Json")
data.append(System.Text.Json.JsonValueKind.Object) # byte-based enum

data.append(list(data)) # list of all the data..
data.append(tuple(data)) # tuple of all the data...
Expand Down
Loading