[pypy-svn] pypy psycopg2compatibility: Fixed translation errors coming from using kwargs. debug_refcount is slightly less nice, but when used with cpyext-call it should be nicer anyways.

ademan commits-noreply at bitbucket.org
Tue Dec 21 13:06:58 CET 2010


Author: Daniel Roberts <Ademan555 at gmail.com>
Branch: psycopg2compatibility
Changeset: r40158:dcafe3478e6e
Date: 2010-12-21 04:02 -0800
http://bitbucket.org/pypy/pypy/changeset/dcafe3478e6e/

Log:	Fixed translation errors coming from using kwargs. debug_refcount
	is slightly less nice, but when used with cpyext-call it should be
	nicer anyways.

diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -255,15 +255,11 @@
 
 DEBUG_REFCOUNT = True
 
-def debug_refcount(*args, **kwargs):
+def debug_refcount(*args):
     from pypy.module.cpyext.api import cpy_logger
-    frame_stackdepth = kwargs.pop("frame_stackdepth", 2)
-    assert not kwargs
-    frame = sys._getframe(frame_stackdepth)
     debug_start('cpyext-refcount')
-    debug_print(cpy_logger.get_indent_string())
-    debug_print(frame.f_code.co_name)
-    debug_print(' '.join([frame.f_code.co_name] + [str(arg) for arg in args]))
+    debug_print(' '.join([cpy_logger.get_indent_string()] +
+                         [str(arg) for arg in args]))
     debug_stop('cpyext-refcount')
 
 def create_ref(space, w_obj, itemcount=0):
@@ -359,7 +355,7 @@
 
     obj.c_ob_refcnt -= 1
     if DEBUG_REFCOUNT:
-        debug_refcount("DECREF", obj, obj.c_ob_refcnt, frame_stackdepth=3)
+        debug_refcount("DECREF", obj, obj.c_ob_refcnt)
     if obj.c_ob_refcnt == 0:
         state = space.fromcache(RefcountState)
         ptr = rffi.cast(ADDR, obj)
@@ -392,7 +388,7 @@
     obj.c_ob_refcnt += 1
     assert obj.c_ob_refcnt > 0
     if DEBUG_REFCOUNT:
-        debug_refcount("INCREF", obj, obj.c_ob_refcnt, frame_stackdepth=3)
+        debug_refcount("INCREF", obj, obj.c_ob_refcnt)
 
 @cpython_api([PyObject], lltype.Void)
 def _Py_NewReference(space, obj):


More information about the Pypy-commit mailing list