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

xoraxax at codespeak.net xoraxax at codespeak.net
Thu Apr 1 15:35:06 CEST 2010


Author: xoraxax
Date: Thu Apr  1 15:35:05 2010
New Revision: 73243

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
Log:
Add more typeobjects to the GLOBALS.

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/api.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/api.py	Thu Apr  1 15:35:05 2010
@@ -213,18 +213,20 @@
 FUNCTIONS_STATIC = {}
 FUNCTIONS_C = {}
 TYPES = {}
-GLOBALS = {
+GLOBALS = { # this needs to include all prebuilt pto, otherwise segfaults occur
     'Py_None': ('PyObject*', 'space.w_None'),
     'Py_True': ('PyObject*', 'space.w_True'),
     'Py_False': ('PyObject*', 'space.w_False'),
-    'PyType_Type#': ('PyTypeObject*', 'space.w_type'),
-    'PyBaseObject_Type#': ('PyTypeObject*', 'space.w_object'),
     }
 
 for exc_name in ['TypeError', 'ValueError', 'KeyError', 'Exception',
                  'BaseException']:
     GLOBALS['PyExc_' + exc_name] = ('PyObject*', 'space.w_' + exc_name)
 
+for cpyname, pypyexpr in [("Type", "space.w_type"), ("BaseObject", "space.w_object"),
+        ("Dict", "space.w_dict"), ("Tuple", "space.w_tuple")]:
+    GLOBALS['Py%s_Type#' % (cpyname, )] = ('PyTypeObject*', pypyexpr)
+
 def get_structtype_for_ctype(ctype):
     from pypy.module.cpyext.typeobjectdefs import PyTypeObjectPtr
     return {"PyObject*": PyObject, "PyTypeObject*": PyTypeObjectPtr}[ctype]



More information about the Pypy-commit mailing list