Skip to content

Commit 34eb9cc

Browse files
committed
Remove superfluous AtExit function
1 parent b2933c4 commit 34eb9cc

4 files changed

Lines changed: 2 additions & 29 deletions

File tree

‎src/runtime/moduleobject.cs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,5 @@ public static string[] ListAssemblies(bool verbose)
534534
}
535535
return names;
536536
}
537-
538-
[ModuleFunction]
539-
public static int _AtExit()
540-
{
541-
return Runtime.AtExit();
542-
}
543537
}
544538
}

‎src/runtime/native/TypeOffset.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ static void ValidateRequiredOffsetsPresent(PropertyInfo[] offsetProperties)
147147
{
148148
"__instancecheck__",
149149
"__subclasscheck__",
150-
"_AtExit",
151150
"AddReference",
152151
"FinalizeObject",
153152
"FindAssembly",

‎src/runtime/pythonengine.cs‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,6 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
198198
Py.SetArgv(args);
199199
}
200200

201-
if (mode == ShutdownMode.Normal)
202-
{
203-
// TOOD: Check if this can be remove completely or not.
204-
// register the atexit callback (this doesn't use Py_AtExit as the C atexit
205-
// callbacks are called after python is fully finalized but the python ones
206-
// are called while the python engine is still running).
207-
//string code =
208-
// "import atexit, clr\n" +
209-
// "atexit.register(clr._AtExit)\n";
210-
//PythonEngine.Exec(code);
211-
}
212-
213201
// Load the clr.py resource into the clr module
214202
NewReference clr = Python.Runtime.ImportHook.GetCLRModule();
215203
BorrowedReference clr_dict = Runtime.PyModule_GetDict(clr);

‎src/runtime/runtime.cs‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ internal static void Shutdown(ShutdownMode mode)
391391
{
392392
ResetPyMembers();
393393
if (mode != ShutdownMode.Extension)
394+
{
394395
Py_Finalize();
396+
}
395397
}
396398
}
397399

@@ -416,16 +418,6 @@ internal static ShutdownMode GetDefaultShutdownMode()
416418
return ShutdownMode.Normal;
417419
}
418420

419-
// called *without* the GIL acquired by clr._AtExit
420-
internal static int AtExit()
421-
{
422-
lock (IsFinalizingLock)
423-
{
424-
IsFinalizing = true;
425-
}
426-
return 0;
427-
}
428-
429421
private static void RunExitFuncs()
430422
{
431423
PyObject atexit;

0 commit comments

Comments
 (0)