From 758975ac24d240747b3e4f3bc7fa682cc94d6ebc Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 21 Mar 2011 13:26:24 +0100 Subject: Issue #10833: Use PyUnicode_FromFormat() and PyErr_Format() instead of PyOS_snprintf(). --- Modules/gcmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 10a4ed7f6a..b05675c84a 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -680,8 +680,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) static void debug_cycle(char *msg, PyObject *op) { - PySys_WriteStderr("gc: %.100s <%.100s %p>\n", - msg, Py_TYPE(op)->tp_name, op); + PySys_FormatStderr("gc: %s <%s %p>\n", + msg, Py_TYPE(op)->tp_name, op); } /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable -- cgit v1.2.1 From dcacb24f386ae1b107462181af42b6826ec15fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 9 Oct 2011 10:38:36 +0200 Subject: =?UTF-8?q?Add=20API=20for=20static=20strings,=20primarily=20good?= =?UTF-8?q?=20for=20identifiers.=20Thanks=20to=20Konrad=20Sch=C3=B6bel=20a?= =?UTF-8?q?nd=20Jasper=20Schulz=20for=20helping=20with=20the=20mass-editin?= =?UTF-8?q?g.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/gcmodule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index b05675c84a..2533de61a2 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -769,7 +769,9 @@ get_time(void) { double result = 0; if (tmod != NULL) { - PyObject *f = PyObject_CallMethod(tmod, "time", NULL); + _Py_identifier(time); + + PyObject *f = _PyObject_CallMethodId(tmod, &PyId_time, NULL); if (f == NULL) { PyErr_Clear(); } -- cgit v1.2.1 From f5ad3b280b43227eb0e3fa63d89490a58ba9c28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Fri, 14 Oct 2011 10:20:37 +0200 Subject: Rename _Py_identifier to _Py_IDENTIFIER. --- Modules/gcmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 2533de61a2..6c8ca38d62 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -769,7 +769,7 @@ get_time(void) { double result = 0; if (tmod != NULL) { - _Py_identifier(time); + _Py_IDENTIFIER(time); PyObject *f = _PyObject_CallMethodId(tmod, &PyId_time, NULL); if (f == NULL) { -- cgit v1.2.1 From 1b6598cb13c0bb93927111a3dc708100dde4480b Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Tue, 15 Nov 2011 00:00:12 +0100 Subject: Issue #13389: Full garbage collection passes now clear the freelists for list and dict objects. They already cleared other freelists in the interpreter. --- Modules/gcmodule.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 6c8ca38d62..154f13623e 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -762,6 +762,8 @@ clear_freelists(void) (void)PyTuple_ClearFreeList(); (void)PyUnicode_ClearFreeList(); (void)PyFloat_ClearFreeList(); + (void)PyList_ClearFreeList(); + (void)PyDict_ClearFreeList(); } static double -- cgit v1.2.1 From 9cc1b02d3debaa59f850bf590154c39df1eb0a93 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 16 Dec 2011 11:24:27 +0100 Subject: Issue #6695: Full garbage collection runs now clear the freelist of set objects. Initial patch by Matthias Troffaes. --- Modules/gcmodule.c | 1 + 1 file changed, 1 insertion(+) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 154f13623e..1876e93884 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -764,6 +764,7 @@ clear_freelists(void) (void)PyFloat_ClearFreeList(); (void)PyList_ClearFreeList(); (void)PyDict_ClearFreeList(); + (void)PySet_ClearFreeList(); } static double -- cgit v1.2.1 From 1a222834067498b2743140f309045f7117867551 Mon Sep 17 00:00:00 2001 From: Kristj?n Valur J?nsson Date: Sun, 8 Apr 2012 13:56:25 +0000 Subject: Remove unused variable from gcmodule.c. The code no longer tests for the presence of a __del__ attribute on objects, rather it uses the tp_del slot. --- Modules/gcmodule.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 1876e93884..d8893d1b16 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -65,9 +65,6 @@ static PyObject *garbage = NULL; /* Python string to use if unhandled exception occurs */ static PyObject *gc_str = NULL; -/* Python string used to look for __del__ attribute. */ -static PyObject *delstr = NULL; - /* This is the number of objects who survived the last full collection. It approximates the number of long lived objects tracked by the GC. @@ -802,12 +799,6 @@ collect(int generation) PyGC_Head *gc; double t1 = 0.0; - if (delstr == NULL) { - delstr = PyUnicode_InternFromString("__del__"); - if (delstr == NULL) - Py_FatalError("gc couldn't allocate \"__del__\""); - } - if (debug & DEBUG_STATS) { PySys_WriteStderr("gc: collecting generation %d...\n", generation); -- cgit v1.2.1