cpython: 5abe85aefe29 (original) (raw)

Mercurial > cpython

changeset 83835:5abe85aefe29

Issue #17937: Try harder to collect cyclic garbage at shutdown. [#17937]

Antoine Pitrou solipsis@pitrou.net
date Sun, 19 May 2013 01:11:58 +0200
parents e79df5d1f680
children 1b5ef05d6ced
files Include/objimpl.h Misc/NEWS Modules/gcmodule.c Python/import.c
diffstat 4 files changed, 32 insertions(+), 6 deletions(-)[+] [-] Include/objimpl.h 4 Misc/NEWS 2 Modules/gcmodule.c 31 Python/import.c 1

line wrap: on

line diff

--- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -232,6 +232,10 @@ PyAPI_FUNC(PyVarObject ) _PyObject_NewV / C equivalent of gc.collect(). / PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void); +#endif + / Test if a type has a GC head */ #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ What's New in Python 3.4.0 Alpha 1? Core and Builtins ----------------- +- Issue #17937: Try harder to collect cyclic garbage at shutdown. +

--- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -853,7 +853,8 @@ get_time(void) /* This is the main function. Read this to understand how the

{ int i; Py_ssize_t m = 0; /* # objects collected */ @@ -1000,10 +1001,15 @@ collect(int generation, Py_ssize_t *n_co } if (PyErr_Occurred()) {

@@ -1544,6 +1550,19 @@ PyGC_Collect(void) return n; } +Py_ssize_t +_PyGC_CollectNoFail(void) +{

+

+} void _PyGC_DumpShutdownStats(void)

--- a/Python/import.c +++ b/Python/import.c @@ -444,6 +444,7 @@ PyImport_Cleanup(void) /* Finally, clear and delete the modules directory */ PyDict_Clear(modules);