[pypy-commit] pypy cpyext-cleanup: Put the defines for global symbols in the decl file in all cases

rlamy pypy.commits at gmail.com
Tue Jan 3 20:02:06 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: cpyext-cleanup
Changeset: r89353:93a816b0600f
Date: 2017-01-04 00:34 +0000
http://bitbucket.org/pypy/pypy/changeset/93a816b0600f/

Log:	Put the defines for global symbols in the decl file in all cases

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -1213,7 +1213,7 @@
 def generate_decls_and_callbacks(db, api_struct=True, prefix=''):
     "NOT_RPYTHON"
     pypy_macros = []
-    export_symbols = sorted(SYMBOLS_C) + sorted(GLOBALS)
+    export_symbols = sorted(SYMBOLS_C)
     for name in export_symbols:
         if '#' in name:
             name, header = name.split('#')
@@ -1292,8 +1292,7 @@
         elif name.startswith('PyExc_'):
             typ = 'PyObject*'
             header = pypy_decl
-        if header != pypy_decl:
-            decls[header].append('#define %s %s' % (name, mangle_name(prefix, name)))
+        decls[header].append('#define %s %s' % (name, mangle_name(prefix, name)))
         decls[header].append('PyAPI_DATA(%s) %s;' % (typ, name))
 
     for header_name in FUNCTIONS_BY_HEADER.keys():
@@ -1433,10 +1432,8 @@
             name, header = name.split('#')
             assert typ in ('PyObject*', 'PyTypeObject*', 'PyIntObject*')
             typ = typ[:-1]
-            if header != pypy_decl:
-                # since the #define is not in pypy_macros, do it here
-                mname = mangle_name(prefix, name)
-                include_lines.append('#define %s %s\n' % (name, mname))
+            mname = mangle_name(prefix, name)
+            include_lines.append('#define %s %s\n' % (name, mname))
         elif name.startswith('PyExc_'):
             typ = 'PyTypeObject'
             name = '_' + name


More information about the pypy-commit mailing list