Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
ImportHook: drop dead code around clr_prefix
  • Loading branch information
lostmsu committed Feb 27, 2021
commit 908316fa766b1db33bda7a28a59c81684775ac89
12 changes: 1 addition & 11 deletions src/runtime/importhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ public static IntPtr __import__(IntPtr self, IntPtr argsRaw, IntPtr kw)
}

string realname = mod_name;
string clr_prefix = null;

// 2010-08-15: Always seemed smart to let python try first...
// This shaves off a few tenths of a second on test_module.py
Expand Down Expand Up @@ -317,10 +316,7 @@ public static IntPtr __import__(IntPtr self, IntPtr argsRaw, IntPtr kw)
}
return new NewReference(module).DangerousMoveToPointer();
}
if (clr_prefix != null)
{
return GetCLRModule(fromList).DangerousMoveToPointerOrNull();
}

module = Runtime.PyDict_GetItemString(modules, names[0]);
return new NewReference(module, canBeNull: true).DangerousMoveToPointer();
}
Expand Down Expand Up @@ -360,12 +356,6 @@ public static IntPtr __import__(IntPtr self, IntPtr argsRaw, IntPtr kw)

// Add the module to sys.modules
Runtime.PyDict_SetItemString(modules, tail.moduleName, tail.ObjectReference);

// If imported from CLR add clr.<modulename> to sys.modules as well
if (clr_prefix != null)
{
Runtime.PyDict_SetItemString(modules, clr_prefix + tail.moduleName, tail.ObjectReference);
}
}

{
Expand Down