[pypy-svn] r72608 - pypy/branch/cpython-extension/pypy/module/cpyext

xoraxax at codespeak.net xoraxax at codespeak.net
Tue Mar 23 02:35:40 CET 2010


Author: xoraxax
Date: Tue Mar 23 02:35:39 2010
New Revision: 72608

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/TODO
   pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py
Log:
Also fill tp_name and tp_basicsize.

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/TODO
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/TODO	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/TODO	Tue Mar 23 02:35:39 2010
@@ -1,6 +1,7 @@
  - Generate header files programmatically.
  - Implement C API.
  - Complete the PyTypeObject initialization code.
+ - Free pto.c_tp_name correctly
 
 PyStringObject support
 ======================

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py	Tue Mar 23 02:35:39 2010
@@ -219,7 +219,7 @@
 
 
 
-def allocate_type_obj(space, w_obj):
+def allocate_type_obj(space, w_type):
     from pypy.module.cpyext.object import PyObject_Del_cast, PyObject_Del
     pto = lltype.malloc(PyTypeObject, None, flavor="raw")
     callable = PyObject_Del_cast
@@ -228,6 +228,9 @@
     callable = PyObject_Del
     pto.c_tp_free = llhelper(callable.api_func.functype,
             make_wrapper(space, callable))
+    # XXX free c_tp_name again!
+    pto.c_tp_name = rffi.str2charp(w_type.getname(space, "?"))
+    pto.c_tp_basicsize = -1 # hopefully this makes malloc bail
     #  XXX fill slots in pto
     return pto
 
@@ -249,10 +252,6 @@
     return 1
 
 W_PyCObject.typedef = W_ObjectObject.typedef
-#TypeDef(
-#    'C_object',
-#    #__getattrbute__ = interp2app(cobject_descr_getattribute),
-#    )
 
 W_PyCTypeObject.typedef = TypeDef(
     'C_type', W_TypeObject.typedef



More information about the Pypy-commit mailing list