[pypy-svn] r72524 - in pypy/trunk/pypy/module/cpyext: . include
afa at codespeak.net
afa at codespeak.net
Mon Mar 22 10:27:54 CET 2010
Author: afa
Date: Mon Mar 22 10:27:52 2010
New Revision: 72524
Modified:
pypy/trunk/pypy/module/cpyext/api.py
pypy/trunk/pypy/module/cpyext/include/Python.h
pypy/trunk/pypy/module/cpyext/include/boolobject.h
pypy/trunk/pypy/module/cpyext/include/object.h
pypy/trunk/pypy/module/cpyext/include/pyerrors.h
Log:
Properly dllexport/dllimport globals; this fixes tests on Windows.
Also generate the bridge library in the temp dir, not in cpyext/include!
Modified: pypy/trunk/pypy/module/cpyext/api.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/api.py (original)
+++ pypy/trunk/pypy/module/cpyext/api.py Mon Mar 22 10:27:52 2010
@@ -18,7 +18,7 @@
Py_ssize_t = lltype.Signed
-include_dir = py.path.local(autopath.pypydir).join('module', 'cpyext', 'include')
+include_dir = py.path.local(autopath.pypydir) / 'module' / 'cpyext' / 'include'
include_dirs = [
include_dir,
udir,
@@ -255,6 +255,7 @@
eci = eci.convert_sources_to_files()
modulename = platform.platform.compile(
[], eci,
+ outputfilename=str(udir / "module_cache" / "pypyapi"),
standalone=False)
# load the bridge, and init structure
Modified: pypy/trunk/pypy/module/cpyext/include/Python.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/Python.h (original)
+++ pypy/trunk/pypy/module/cpyext/include/Python.h Mon Mar 22 10:27:52 2010
@@ -4,19 +4,25 @@
#include <pypy_rename.h>
/* Compat stuff */
#ifndef _WIN32
-#include <inttypes.h>
-#include <stdint.h>
-#include <stddef.h>
-#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
+# include <inttypes.h>
+# include <stdint.h>
+# include <stddef.h>
+# define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
+# define PyAPI_DATA(RTYPE) extern RTYPE
#else
-#define Py_DEPRECATED(VERSION_UNUSED)
+# define Py_DEPRECATED(VERSION_UNUSED)
+# ifdef Py_BUILD_CORE
+# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
+# else
+# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
+# endif
#endif
#define Py_ssize_t long
#include "object.h"
/* move somewhere else */
-extern PyObject *Py_None;
+PyAPI_DATA(PyObject *) Py_None;
#include <stdio.h>
Modified: pypy/trunk/pypy/module/cpyext/include/boolobject.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/boolobject.h (original)
+++ pypy/trunk/pypy/module/cpyext/include/boolobject.h Mon Mar 22 10:27:52 2010
@@ -7,9 +7,8 @@
extern "C" {
#endif
-extern PyObject *Py_True;
-
-extern PyObject *Py_False;
+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
Modified: pypy/trunk/pypy/module/cpyext/include/object.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/object.h (original)
+++ pypy/trunk/pypy/module/cpyext/include/object.h Mon Mar 22 10:27:52 2010
@@ -375,8 +375,8 @@
#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL
-extern PyTypeObject *PyType_Type; /* built-in 'type' */
-extern PyTypeObject *PyBaseObject_Type;
+PyAPI_DATA(PyTypeObject *) PyType_Type; /* built-in 'type' */
+PyAPI_DATA(PyTypeObject *) PyBaseObject_Type;
int PyPyType_Ready(PyTypeObject *);
#define PyType_Ready PyPyType_Ready
Modified: pypy/trunk/pypy/module/cpyext/include/pyerrors.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/pyerrors.h (original)
+++ pypy/trunk/pypy/module/cpyext/include/pyerrors.h Mon Mar 22 10:27:52 2010
@@ -7,7 +7,7 @@
extern "C" {
#endif
-extern PyObject *PyExc_Exception;
+PyAPI_DATA(PyObject *) PyExc_Exception;
void PyErr_SetString(PyObject *, char *);
#ifdef __cplusplus
More information about the Pypy-commit
mailing list