[pypy-svn] pypy default: Remove modsupport.inl, and instead use a #define to just redeclare
arigo
commits-noreply at bitbucket.org
Thu Jan 27 13:59:02 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r41386:52100d70d94f
Date: 2011-01-27 13:56 +0100
http://bitbucket.org/pypy/pypy/changeset/52100d70d94f/
Log: Remove modsupport.inl, and instead use a #define to just redeclare
Py_InitModule4() to be _Py_InitPyPyModule().
diff --git a/pypy/module/cpyext/test/test_api.py b/pypy/module/cpyext/test/test_api.py
--- a/pypy/module/cpyext/test/test_api.py
+++ b/pypy/module/cpyext/test/test_api.py
@@ -77,5 +77,5 @@
assert f.check(file=True)
py.test.raises(py.error.EACCES, "f.open('w')") # check that it's not writable
check('Python.h')
- check('modsupport.inl')
+ check('modsupport.h')
check('pypy_decl.h')
diff --git a/pypy/module/cpyext/include/Python.h b/pypy/module/cpyext/include/Python.h
--- a/pypy/module/cpyext/include/Python.h
+++ b/pypy/module/cpyext/include/Python.h
@@ -124,8 +124,6 @@
#include <pypy_decl.h>
-#include "modsupport.inl"
-
/* Define macros for inline documentation. */
#define PyDoc_VAR(name) static char name[]
#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
diff --git a/pypy/module/cpyext/include/modsupport.inl b/pypy/module/cpyext/include/modsupport.inl
deleted file mode 100644
--- a/pypy/module/cpyext/include/modsupport.inl
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- C -*- */
-/* Module support interface */
-
-#ifndef Py_MODSUPPORT_INL
-#define Py_MODSUPPORT_INL
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef PYPY_STANDALONE
-/* XXX1 On translation, forwarddecl.h is included after this file */
-/* XXX2 genc.py transforms "const char*" into "char*" */
-extern PyObject *_Py_InitPyPyModule(char *, PyMethodDef *, char *, PyObject *, int);
-#endif
-
-Py_LOCAL_INLINE(PyObject *) Py_InitModule4(
- const char* name, PyMethodDef* methods,
- const char* doc, PyObject *self,
- int api_version)
-{
- return _Py_InitPyPyModule((char*)name, methods,
- (char*)doc, self,
- api_version);
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_MODSUPPORT_INL */
diff --git a/pypy/tool/release/test/test_package.py b/pypy/tool/release/test/test_package.py
--- a/pypy/tool/release/test/test_package.py
+++ b/pypy/tool/release/test/test_package.py
@@ -52,7 +52,7 @@
else:
assert th.getmember(member)
check_include('Python.h')
- check_include('modsupport.inl')
+ check_include('modsupport.h')
check_include('pypy_decl.h')
finally:
if fake_pypy_c:
diff --git a/pypy/module/cpyext/include/modsupport.h b/pypy/module/cpyext/include/modsupport.h
--- a/pypy/module/cpyext/include/modsupport.h
+++ b/pypy/module/cpyext/include/modsupport.h
@@ -18,6 +18,11 @@
const char *, char **, ...);
int PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
const char *, char **, va_list);
+
+/* to make sure that modules compiled with CPython's or PyPy's Python.h
+ are not importable on the other interpreter, use a #define to expect a
+ different symbol: (this function is implemented in ../modsupport.py) */
+#define Py_InitModule4 _Py_InitPyPyModule
#define Py_InitModule(name, methods) \
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
diff --git a/pypy/module/cpyext/modsupport.py b/pypy/module/cpyext/modsupport.py
--- a/pypy/module/cpyext/modsupport.py
+++ b/pypy/module/cpyext/modsupport.py
@@ -33,7 +33,6 @@
# This is actually the Py_InitModule4 function,
# renamed to refuse modules built against CPython headers.
-# The implementation of Py_InitModule4 is in include/modsupport.inl
@cpython_api([CONST_STRING, lltype.Ptr(PyMethodDef), CONST_STRING,
PyObject, rffi.INT_real], PyObject)
def _Py_InitPyPyModule(space, name, methods, doc, w_self, apiver):
More information about the Pypy-commit
mailing list