From fc5db95e0063eafa2bfb7f487fcaad5a7c4b65a1 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 13 Dec 2017 02:29:07 +0100 Subject: Test atexit shutdown mechanism in a subprocess (#4828) * Test atexit shutdown mechanism in a subprocess --- Python/pylifecycle.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python/pylifecycle.c') diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index fdb09d910d..f284855f34 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -2086,6 +2086,8 @@ _Py_FatalInitError(_PyInitError err) /* For the atexit module. */ void _Py_PyAtExit(void (*func)(void)) { + /* Guard against API misuse (see bpo-17852) */ + assert(_PyRuntime.pyexitfunc == NULL || _PyRuntime.pyexitfunc == func); _PyRuntime.pyexitfunc = func; } -- cgit v1.2.1