Author: Ronan Lamy <[email protected]>
Branch: cpyext-leakchecking
Changeset: r92005:5e01a8ace2de
Date: 2017-07-31 21:56 +0100
http://bitbucket.org/pypy/pypy/changeset/5e01a8ace2de/
Log: fix pseudo-leak in test_traceback.py
diff --git a/pypy/module/cpyext/test/test_traceback.py
b/pypy/module/cpyext/test/test_traceback.py
--- a/pypy/module/cpyext/test/test_traceback.py
+++ b/pypy/module/cpyext/test/test_traceback.py
@@ -3,17 +3,19 @@
from pypy.module.cpyext.pyobject import PyObject, make_ref, from_ref
from pypy.module.cpyext.pytraceback import PyTracebackObject
from pypy.interpreter.pytraceback import PyTraceback
-from pypy.interpreter.pyframe import PyFrame
+from pypy.interpreter.baseobjspace import AppExecCache
class TestPyTracebackObject(BaseApiTest):
def test_traceback(self, space, api):
- w_traceback = space.appexec([], """():
+ src = """():
import sys
try:
1/0
except:
return sys.exc_info()[2]
- """)
+ """
+ w_traceback = space.appexec([], src)
+
py_obj = make_ref(space, w_traceback)
py_traceback = rffi.cast(PyTracebackObject, py_obj)
assert (from_ref(space, rffi.cast(PyObject, py_traceback.c_ob_type)) is
@@ -38,3 +40,5 @@
assert lltype.normalizeptr(py_traceback) is None
api.Py_DecRef(py_obj)
+ # hack to allow the code object to be freed
+ del space.fromcache(AppExecCache).content[src]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit