[pypy-svn] r73506 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test

xoraxax at codespeak.net xoraxax at codespeak.net
Wed Apr 7 16:08:28 CEST 2010


Author: xoraxax
Date: Wed Apr  7 16:08:23 2010
New Revision: 73506

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
Log:
Change decl generation again to let it work on 32 bit systems where long and int collide as well as generally when the exceptions were broken.

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	Wed Apr  7 16:08:23 2010
@@ -526,6 +526,7 @@
     # implement function callbacks and generate function decls
     functions = []
     pypy_decls = []
+    pypy_decls.append("#ifndef PYPY_STANDALONE\n")
     for name, func in sorted(FUNCTIONS.iteritems()):
         restype = db.gettype(func.restype).replace('@', '')
         args = []
@@ -541,11 +542,13 @@
                                  for i in range(len(func.argtypes)))
             body = "{ return _pypyAPI.%s(%s); }" % (name, callargs)
             functions.append('%s\n%s\n' % (header, body))
-    pypy_decls.append("#ifndef PYPY_STANDALONE\n")
     for name, (typ, expr) in GLOBALS.iteritems():
-        if not globals_are_pointers and "#" in name:
+        name_clean = name.replace("#", "")
+        if not globals_are_pointers:
             typ = typ.replace("*", "")
-        pypy_decls.append('PyAPI_DATA(%s) %s;' % (typ, name.replace("#", "")))
+        pypy_decls.append('PyAPI_DATA(%s) %s;' % (typ, name_clean))
+        if not globals_are_pointers and "#" not in name:
+            pypy_decls.append("#define %s &%s" % (name, name,))
     for name in VA_TP_LIST:
         name_no_star = process_va_name(name)
         header = ('%s pypy_va_get_%s(va_list* vp)' %

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	Wed Apr  7 16:08:23 2010
@@ -97,5 +97,6 @@
         assert m
         m = re.search("xyz", "xyzxyz")
         assert m
+        assert dir(m)
         re._cache.clear()
         re._cache_repl.clear()



More information about the Pypy-commit mailing list