comparison Python/pythonrun.c @ 87676:cc8953ea3c7e

Closes #19831: Stop tracemalloc later at Python shutdown to be able to use tracemalloc in objects destructor Replace atexit handler with an harcoded C function _PyTraceMalloc_Fini().
author Victor Stinner <victor.stinner@gmail.com>
date Sun, 01 Dec 2013 10:03:26 +0100
parents 6e2089dbc5ad
children
comparison
equal deleted inserted replaced
87675:ddbf9632795b 87676:cc8953ea3c7e
104 extern void PyLong_Fini(void); 104 extern void PyLong_Fini(void);
105 extern int _PyFaulthandler_Init(void); 105 extern int _PyFaulthandler_Init(void);
106 extern void _PyFaulthandler_Fini(void); 106 extern void _PyFaulthandler_Fini(void);
107 extern void _PyHash_Fini(void); 107 extern void _PyHash_Fini(void);
108 extern int _PyTraceMalloc_Init(void); 108 extern int _PyTraceMalloc_Init(void);
109 extern int _PyTraceMalloc_Fini(void);
109 110
110 #ifdef WITH_THREAD 111 #ifdef WITH_THREAD
111 extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); 112 extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
112 extern void _PyGILState_Fini(void); 113 extern void _PyGILState_Fini(void);
113 #endif /* WITH_THREAD */ 114 #endif /* WITH_THREAD */
639 * XXX Python code getting called. 640 * XXX Python code getting called.
640 */ 641 */
641 #if 0 642 #if 0
642 PyGC_Collect(); 643 PyGC_Collect();
643 #endif 644 #endif
645
646 /* Disable tracemalloc after all Python objects have been destroyed,
647 so it is possible to use tracemalloc in objects destructor. */
648 _PyTraceMalloc_Fini();
644 649
645 /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ 650 /* Destroy the database used by _PyImport_{Fixup,Find}Extension */
646 _PyImport_Fini(); 651 _PyImport_Fini();
647 652
648 /* Cleanup typeobject.c's internal caches. */ 653 /* Cleanup typeobject.c's internal caches. */