Patch #1680961: remove sys.exitfunc and replace it with a private C API. Also, reimplement atexit in C so it can take advantage of this private API.
diff --git a/Modules/Setup.dist b/Modules/Setup.dist
index 46f4253..173dfcc 100644
--- a/Modules/Setup.dist
+++ b/Modules/Setup.dist
@@ -176,6 +176,7 @@
#collections collectionsmodule.c # Container types
#itertools itertoolsmodule.c # Functions creating iterators for efficient looping
#strop stropmodule.c # String manipulations
+#atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
#unicodedata unicodedata.c # static Unicode character database