[pypy-svn] r44227 - in pypy/branch/kill-ctypes/pypy/module/_curses: . test
fijal at codespeak.net
fijal at codespeak.net
Wed Jun 13 12:11:08 CEST 2007
Author: fijal
Date: Wed Jun 13 12:11:08 2007
New Revision: 44227
Modified:
pypy/branch/kill-ctypes/pypy/module/_curses/fficurses.py
pypy/branch/kill-ctypes/pypy/module/_curses/test/test_curses.py
Log:
fix memory leakage + seems that tigetstr result is constant
Modified: pypy/branch/kill-ctypes/pypy/module/_curses/fficurses.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/module/_curses/fficurses.py (original)
+++ pypy/branch/kill-ctypes/pypy/module/_curses/fficurses.py Wed Jun 13 12:11:08 2007
@@ -73,8 +73,6 @@
if num == 0 or num == -1:
raise interp_curses.TermError()
res = rffi.charp2str(ll_res)
- # XXX - how to avoid a problem with leaking stuff here???
- #lltype.free(ll_res, flavor='raw')
return res
finally:
lltype.free(ll_cap, flavor='raw')
@@ -92,9 +90,9 @@
ll_res = c_tparm(ll_s, l[0], l[1], l[2], l[3], l[4], l[5], l[6],
l[7], l[8], l[9])
lltype.free(ll_s, flavor='raw')
- # XXX - how to make this happy?
- #lltype.free(ll_res, flavor.raw)
- return rffi.charp2str(ll_res)
+ res = rffi.charp2str(ll_res)
+ lltype.free(ll_res, flavor='raw')
+ return res
register_external(interp_curses._curses_tparm, [str, [int]], str,
export_name='_curses.tparm', llimpl=tparm_llimpl)
Modified: pypy/branch/kill-ctypes/pypy/module/_curses/test/test_curses.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/module/_curses/test/test_curses.py (original)
+++ pypy/branch/kill-ctypes/pypy/module/_curses/test/test_curses.py Wed Jun 13 12:11:08 2007
@@ -85,5 +85,5 @@
assert res == '\033[6;4H'
fn = compile(runs_tparm, [])
- fn()
+ fn(expected_extra_mallocs=-1)
More information about the Pypy-commit
mailing list