FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove compile-time check on NETSTANDARD · sdpython/pythonnet@98da1fa · GitHub

This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Repository navigation

Commit 98da1fa

Browse files
committed
Remove compile-time check on NETSTANDARD
Even if netstandard lacks (for now) the necessary APIs for domain (un)loading, it is still possible to (un)load domains via the Mono C runtime.
1 parent 6a3cfc8 commit 98da1fa

2 files changed

Lines changed: 1 addition & 17 deletions

File tree

‎src/runtime/runtime.cs‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,12 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
151151
{
152152
PyEval_InitThreads();
153153
}
154-
if (mode == ShutdownMode.Soft)
155-
{
156-
RuntimeState.Save();
157-
}
158-
#if !NETSTANDARD
159154
// XXX: Reload mode may reduct to Soft mode,
160155
// so even on Reload mode it still needs to save the RuntimeState
161-
else if (mode == ShutdownMode.Reload)
156+
if (mode == ShutdownMode.Soft || mode == ShutdownMode.Reload)
162157
{
163158
RuntimeState.Save();
164159
}
165-
#endif
166160
}
167161
else if (!fromPython)
168162
{
@@ -190,13 +184,11 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
190184

191185
// Initialize modules that depend on the runtime class.
192186
AssemblyManager.Initialize();
193-
#if !NETSTANDARD
194187
if (mode == ShutdownMode.Reload && RuntimeData.HasStashData())
195188
{
196189
RuntimeData.RestoreRuntimeData();
197190
}
198191
else
199-
#endif
200192
{
201193
PyCLRMetaType = MetaType.Initialize(); // Steal a reference
202194
ImportHook.Initialize();
@@ -342,9 +334,7 @@ static ShutdownMode TryDowngradeShutdown(ShutdownMode mode)
342334
if (
343335
mode == Runtime.ShutdownMode
344336
|| mode == ShutdownMode.Normal
345-
#if !NETSTANDARD
346337
|| (mode == ShutdownMode.Soft && Runtime.ShutdownMode == ShutdownMode.Reload)
347-
#endif
348338
)
349339
{
350340
return mode;
@@ -374,12 +364,10 @@ internal static void Shutdown(ShutdownMode mode)
374364
{
375365
RunExitFuncs();
376366
}
377-
#if !NETSTANDARD
378367
if (mode == ShutdownMode.Reload)
379368
{
380369
RuntimeData.Stash();
381370
}
382-
#endif
383371
AssemblyManager.Shutdown();
384372
ImportHook.Shutdown();
385373

‎src/runtime/typemanager.cs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ internal static SlotsHolder SetupMetaSlots(Type impl, IntPtr type)
459459

460460
Marshal.WriteIntPtr(type, TypeOffset.tp_methods, mdefStart);
461461

462-
#if !NETSTANDARD
463462
// XXX: Hard code with mode check.
464463
if (Runtime.ShutdownMode != ShutdownMode.Reload)
465464
{
@@ -470,7 +469,6 @@ internal static SlotsHolder SetupMetaSlots(Type impl, IntPtr type)
470469
Marshal.WriteIntPtr(t, offset, IntPtr.Zero);
471470
});
472471
}
473-
#endif
474472
return slotsHolder;
475473
}
476474

@@ -480,10 +478,8 @@ private static IntPtr AddCustomMetaMethod(string name, IntPtr type, IntPtr mdef,
480478
ThunkInfo thunkInfo = Interop.GetThunk(mi, "BinaryFunc");
481479
slotsHolder.KeeapAlive(thunkInfo);
482480

483-
#if !NETSTANDARD
484481
// XXX: Hard code with mode check.
485482
if (Runtime.ShutdownMode != ShutdownMode.Reload)
486-
#endif
487483
{
488484
IntPtr mdefAddr = mdef;
489485
slotsHolder.AddDealloctor(() =>

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL