[pypy-svn] r78275 - pypy/branch/leak-finder-more/pypy/module/cpyext

afa at codespeak.net afa at codespeak.net
Mon Oct 25 18:22:29 CEST 2010


Author: afa
Date: Mon Oct 25 18:22:28 2010
New Revision: 78275

Modified:
   pypy/branch/leak-finder-more/pypy/module/cpyext/typeobject.py
Log:
This function is a @specialize.memo() and will be called only once.
Mark allocations as immortal.


Modified: pypy/branch/leak-finder-more/pypy/module/cpyext/typeobject.py
==============================================================================
--- pypy/branch/leak-finder-more/pypy/module/cpyext/typeobject.py	(original)
+++ pypy/branch/leak-finder-more/pypy/module/cpyext/typeobject.py	Mon Oct 25 18:22:28 2010
@@ -193,10 +193,12 @@
     if state.new_method_def:
         return state.new_method_def
     from pypy.module.cpyext.modsupport import PyMethodDef
-    ptr = lltype.malloc(PyMethodDef, flavor="raw", zero=True)
-    ptr.c_ml_name = rffi.str2charp("__new__")
+    ptr = lltype.malloc(PyMethodDef, flavor="raw", zero=True,
+                        immortal=True)
+    ptr.c_ml_name = rffi.str2charp_immortal("__new__")
     rffi.setintfield(ptr, 'c_ml_flags', METH_VARARGS | METH_KEYWORDS)
-    ptr.c_ml_doc = rffi.str2charp("T.__new__(S, ...) -> a new object with type S, a subtype of T")
+    ptr.c_ml_doc = rffi.str2charp_immortal(
+        "T.__new__(S, ...) -> a new object with type S, a subtype of T")
     state.new_method_def = ptr
     return ptr
 



More information about the Pypy-commit mailing list