[pypy-commit] cffi static-callback: tweak the pypy-only generated code

arigo noreply at buildbot.pypy.org
Sun Nov 15 02:25:36 EST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: static-callback
Changeset: r2398:b679cab967ff
Date: 2015-11-15 08:26 +0100
http://bitbucket.org/cffi/cffi/changeset/b679cab967ff/

Log:	tweak the pypy-only generated code

diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h
--- a/cffi/_cffi_include.h
+++ b/cffi/_cffi_include.h
@@ -205,7 +205,8 @@
 
 /**********  end CPython-specific section  **********/
 #else
-extern void _cffi_call_python(struct _cffi_callpy_s *, char *);
+_CFFI_UNUSED_FN
+static void (*_cffi_call_python)(struct _cffi_callpy_s *, char *);
 #endif
 
 
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -370,6 +370,9 @@
         prnt('PyMODINIT_FUNC')
         prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,))
         prnt('{')
+        prnt('    if (((intptr_t)p[0]) >= 0x0A03) {')
+        prnt('        _cffi_call_python = p[1];')
+        prnt('    }')
         prnt('    p[0] = (const void *)%s;' % VERSION)
         prnt('    p[1] = &_cffi_type_context;')
         prnt('}')


More information about the pypy-commit mailing list