[pypy-svn] pypy fast-forward: Hack and provide a (slow!) version of sys.getrefcount() based on gc.get_referrers().

amauryfa commits-noreply at bitbucket.org
Mon Jan 3 14:41:51 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40337:673508d9a7c5
Date: 2011-01-03 14:40 +0100
http://bitbucket.org/pypy/pypy/changeset/673508d9a7c5/

Log:	Hack and provide a (slow!) version of sys.getrefcount() based on
	gc.get_referrers().

diff --git a/lib_pypy/_ctypes_test.py b/lib_pypy/_ctypes_test.py
--- a/lib_pypy/_ctypes_test.py
+++ b/lib_pypy/_ctypes_test.py
@@ -1,9 +1,10 @@
 import os, sys
 import tempfile
+import gc
 
 # Monkeypatch & hacks to let ctypes.tests import.
 # This should be removed at some point.
-sys.getrefcount = None
+sys.getrefcount = lambda x: len(gc.get_referrers(x)) - 1
 import _ctypes
 _ctypes.PyObj_FromPtr = None
 del _ctypes


More information about the Pypy-commit mailing list