[pypy-commit] pypy default: CPython compat: accept (but ignore) an argument to gc.collect().

arigo noreply at buildbot.pypy.org
Mon Nov 11 00:18:00 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r67937:7fdbc8f2860e
Date: 2013-11-11 00:17 +0100
http://bitbucket.org/pypy/pypy/changeset/7fdbc8f2860e/

Log:	CPython compat: accept (but ignore) an argument to gc.collect().

diff --git a/pypy/module/gc/interp_gc.py b/pypy/module/gc/interp_gc.py
--- a/pypy/module/gc/interp_gc.py
+++ b/pypy/module/gc/interp_gc.py
@@ -3,8 +3,9 @@
 from rpython.rlib import rgc
 from rpython.rlib.streamio import open_file_as_stream
 
-def collect(space):
-    "Run a full collection."
+ at unwrap_spec(generation=int)
+def collect(space, generation=0):
+    "Run a full collection.  The optional argument is ignored."
     # First clear the method cache.  See test_gc for an example of why.
     if space.config.objspace.std.withmethodcache:
         from pypy.objspace.std.typeobject import MethodCache
diff --git a/pypy/module/gc/test/test_gc.py b/pypy/module/gc/test/test_gc.py
--- a/pypy/module/gc/test/test_gc.py
+++ b/pypy/module/gc/test/test_gc.py
@@ -4,6 +4,7 @@
     def test_collect(self):
         import gc
         gc.collect() # mostly a "does not crash" kind of test
+        gc.collect(0) # mostly a "does not crash" kind of test
 
     def test_disable_finalizers(self):
         import gc


More information about the pypy-commit mailing list