[pypy-svn] r73196 - in pypy/branch/cpython-extension/pypy/module/cpyext: . include

xoraxax at codespeak.net xoraxax at codespeak.net
Wed Mar 31 01:41:09 CEST 2010


Author: xoraxax
Date: Wed Mar 31 01:41:08 2010
New Revision: 73196

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
   pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h
   pypy/branch/cpython-extension/pypy/module/cpyext/include/boolobject.h
   pypy/branch/cpython-extension/pypy/module/cpyext/include/object.h
   pypy/branch/cpython-extension/pypy/module/cpyext/include/pyerrors.h
Log:
Also generate globals decls if necessary.

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 Mar 31 01:41:08 2010
@@ -484,7 +484,7 @@
     struct PyPyAPI* pypyAPI = &_pypyAPI;
     """ % dict(members=structmembers)
 
-    functions = generate_decls_and_callbacks(db)
+    functions = generate_decls_and_callbacks(db, True)
 
     global_objects = []
     for name, (type, expr) in GLOBALS.iteritems():
@@ -552,7 +552,7 @@
     pypy_macros_h = udir.join('pypy_macros.h')
     pypy_macros_h.write('\n'.join(pypy_macros))
 
-def generate_decls_and_callbacks(db):
+def generate_decls_and_callbacks(db, declare_globals):
     # implement function callbacks and generate function decls
     functions = []
     pypy_decls = []
@@ -569,6 +569,9 @@
         pypy_decls.append(header + ";")
         body = "{ return _pypyAPI.%s(%s); }" % (name, callargs)
         functions.append('%s\n%s\n' % (header, body))
+    if declare_globals:
+        for name, (typ, expr) in GLOBALS.iteritems():
+            pypy_decls.append('PyAPI_DATA(%s) %s;' % (typ, name.replace("#", "")))
 
     pypy_decl_h = udir.join('pypy_decl.h')
     pypy_decl_h.write('\n'.join(pypy_decls))
@@ -606,9 +609,9 @@
 
     generate_macros(export_symbols, rename)
 
-    generate_decls_and_callbacks(db)
+    generate_decls_and_callbacks(db, False)
 
-    eci = build_eci(False, export_symbols)
+    eci = build_eci(False, export_symbols) # XXX use eci
 
     bootstrap_types(space)
 

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h	Wed Mar 31 01:41:08 2010
@@ -24,10 +24,6 @@
 
 #include "object.h"
 
-/* move somewhere else */
-PyAPI_DATA(PyObject *) Py_None;
-
-
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/include/boolobject.h
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/include/boolobject.h	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/include/boolobject.h	Wed Mar 31 01:41:08 2010
@@ -7,9 +7,6 @@
 extern "C" {
 #endif
 
-PyAPI_DATA(PyObject *) Py_True;
-PyAPI_DATA(PyObject *) Py_False;
-
 /* Macros for returning Py_True or Py_False, respectively */
 #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
 #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/include/object.h
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/include/object.h	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/include/object.h	Wed Mar 31 01:41:08 2010
@@ -383,11 +383,6 @@
 #define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL
 
 
-PyAPI_DATA(PyTypeObject *) PyType_Type; /* built-in 'type' */
-PyAPI_DATA(PyTypeObject *) PyBaseObject_Type;
-PyAPI_DATA(PyObject *) PyExc_TypeError;
-PyAPI_DATA(PyObject *) PyExc_SystemError;
-
 /* objimpl.h ----------------------------------------------*/
 
 #define PyObject_New(type, typeobj) \

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/include/pyerrors.h
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/include/pyerrors.h	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/include/pyerrors.h	Wed Mar 31 01:41:08 2010
@@ -9,8 +9,6 @@
 
 PyObject *PyErr_NewException(char *name, PyObject *base, PyObject *dict);
 
-PyAPI_DATA(PyObject *) PyExc_Exception;
-
 #ifdef __cplusplus
 }
 #endif



More information about the Pypy-commit mailing list