Skip to content
Closed
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
Next Next commit
Rollback symbol loading for __Internal
  • Loading branch information
amos402 committed Dec 15, 2019
commit 65e209e00d76a39007b86b4a3c825ab1e38a1d2c
19 changes: 11 additions & 8 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1946,15 +1946,15 @@ internal static IntPtr PyMem_Realloc(IntPtr ptr, long size)

internal static void SetNoSiteFlag()
{
if (_PythonDll == "__Internal")
{
throw new NotSupportedException("SetNoSiteFlag didn't support on static compile");
}
var loader = LibraryLoader.Get(OperatingSystem);
IntPtr dllLocal = loader.Load(_PythonDll);
if (dllLocal == IntPtr.Zero)
IntPtr dllLocal;
if (_PythonDll != "__Internal")
{
throw new Exception($"Cannot load {_PythonDll}");
dllLocal = loader.Load(_PythonDll);
if (dllLocal == IntPtr.Zero)
{
throw new Exception($"Cannot load {_PythonDll}");
}
}
try
{
Expand All @@ -1963,7 +1963,10 @@ internal static void SetNoSiteFlag()
}
finally
{
loader.Free(dllLocal);
if (dllLocal != IntPtr.Zero)
{
loader.Free(dllLocal);
}
}
}
}
Expand Down