[pypy-svn] r72543 - in pypy/trunk/pypy/module/cpyext: . include
afa at codespeak.net
afa at codespeak.net
Mon Mar 22 13:39:52 CET 2010
Author: afa
Date: Mon Mar 22 13:39:50 2010
New Revision: 72543
Modified:
pypy/trunk/pypy/module/cpyext/api.py
pypy/trunk/pypy/module/cpyext/include/object.h
pypy/trunk/pypy/module/cpyext/typeobject.py
Log:
Add a way to declare api functions implemented in C.
this allows the dll to export them correctly, and fixes tests on Windows.
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 13:39:50 2010
@@ -62,6 +62,11 @@
return func
return decorate
+def cpython_api_c():
+ def decorate(func):
+ FUNCTIONS_C[func.func_name] = None
+ return decorate
+
def cpython_struct(name, fields, forward=None):
configname = name.replace(' ', '__')
setattr(CConfig, configname, rffi_platform.Struct(name, fields))
@@ -71,6 +76,7 @@
return forward
FUNCTIONS = {}
+FUNCTIONS_C = {}
TYPES = {}
GLOBALS = {
'Py_None': ('PyObject*', 'space.w_None'),
@@ -179,7 +185,7 @@
def build_bridge(space, rename=True):
db = LowLevelDatabase()
- export_symbols = list(FUNCTIONS) + list(GLOBALS)
+ export_symbols = list(FUNCTIONS) + list(FUNCTIONS_C) + list(GLOBALS)
structindex = {}
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 13:39:50 2010
@@ -377,8 +377,7 @@
PyAPI_DATA(PyTypeObject *) PyType_Type; /* built-in 'type' */
PyAPI_DATA(PyTypeObject *) PyBaseObject_Type;
-int PyPyType_Ready(PyTypeObject *);
-#define PyType_Ready PyPyType_Ready
+int PyType_Ready(PyTypeObject *);
/* objimpl.h ----------------------------------------------*/
Modified: pypy/trunk/pypy/module/cpyext/typeobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/typeobject.py (original)
+++ pypy/trunk/pypy/module/cpyext/typeobject.py Mon Mar 22 13:39:50 2010
@@ -8,8 +8,9 @@
from pypy.objspace.std.typeobject import W_TypeObject
from pypy.objspace.std.objectobject import W_ObjectObject
from pypy.interpreter.typedef import TypeDef
-from pypy.module.cpyext.api import cpython_api, cpython_struct, PyObject, \
- PyVarObjectFields, Py_ssize_t, Py_TPFLAGS_READYING, Py_TPFLAGS_READY
+from pypy.module.cpyext.api import cpython_api, cpython_api_c, cpython_struct
+from pypy.module.cpyext.api import PyObject, PyVarObjectFields, Py_ssize_t
+from pypy.module.cpyext.api import Py_TPFLAGS_READYING, Py_TPFLAGS_READY
from pypy.interpreter.module import Module
from pypy.module.cpyext.modsupport import PyMethodDef, convert_method_defs
from pypy.module.cpyext.state import State
@@ -171,6 +172,9 @@
w_type.ready()
return w_type
+ at cpython_api_c()
+def PyType_Ready(space, pto):
+ "Implemented in typeobject.c"
@cpython_api([PyTypeObjectPtr], rffi.INT_real)
def PyPyType_Register(space, pto):
More information about the Pypy-commit
mailing list