Author: mattip <[email protected]>
Branch: cpyext-ext
Changeset: r82358:8b4f91899232
Date: 2016-02-20 14:28 +0100
http://bitbucket.org/pypy/pypy/changeset/8b4f91899232/
Log: fix merge
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
@@ -119,6 +119,8 @@
def is_valid_fp(fp):
return is_valid_fd(fileno(fp))
+pypy_decl = 'pypy_decl.h'
+
constant_names = """
Py_TPFLAGS_READY Py_TPFLAGS_READYING Py_TPFLAGS_HAVE_GETCHARBUFFER
METH_COEXIST METH_STATIC METH_CLASS
@@ -128,7 +130,7 @@
""".split()
for name in constant_names:
setattr(CConfig_constants, name, rffi_platform.ConstantInteger(name))
-udir.join('pypy_decl.h').write("/* Will be filled later */\n")
+udir.join(pypy_decl).write("/* Will be filled later */\n")
udir.join('pypy_structmember_decl.h').write("/* Will be filled later */\n")
udir.join('pypy_macros.h').write("/* Will be filled later */\n")
globals().update(rffi_platform.configure(CConfig_constants))
@@ -233,7 +235,7 @@
wrapper.c_name = cpyext_namespace.uniquename(self.c_name)
return wrapper
-def cpython_api(argtypes, restype, error=_NOT_SPECIFIED, header='pypy_decl.h',
+def cpython_api(argtypes, restype, error=_NOT_SPECIFIED, header=pypy_decl,
gil=None):
"""
Declares a function to be exported.
@@ -964,7 +966,7 @@
# implement function callbacks and generate function decls
functions = []
decls = {}
- pypy_decls = decls['pypy_decl.h'] = []
+ pypy_decls = decls[pypy_decl] = []
pypy_decls.append("#ifndef _PYPY_PYPY_DECL_H\n")
pypy_decls.append("#define _PYPY_PYPY_DECL_H\n")
pypy_decls.append("#ifndef PYPY_STANDALONE\n")
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -5,7 +5,7 @@
from rpython.rtyper.lltypesystem import rffi, lltype
from pypy.module.cpyext.api import (
cpython_api, generic_cpy_call, PyObject, Py_ssize_t, Py_TPFLAGS_CHECKTYPES,
- mangle_name)
+ mangle_name, pypy_decl)
from pypy.module.cpyext.typeobjectdefs import (
unaryfunc, wrapperfunc, ternaryfunc, PyTypeObjectPtr, binaryfunc,
getattrfunc, getattrofunc, setattrofunc, lenfunc, ssizeargfunc, inquiry,
@@ -365,7 +365,9 @@
def build_slot_tp_function(space, typedef, name):
w_type = space.gettypeobject(typedef)
- external = mangle_name('', typedef.name) is not None
+ header = pypy_decl
+ if mangle_name('', typedef.name) is None:
+ header = None
if name == 'tp_setattro':
setattr_fn = w_type.getdictvalue(space, '__setattr__')
delattr_fn = w_type.getdictvalue(space, '__delattr__')
@@ -373,7 +375,7 @@
return
@cpython_api([PyObject, PyObject, PyObject], rffi.INT_real,
- error=-1, external=external)
+ error=-1, header=header)
@func_renamer("cpyext_tp_setattro_%s" % (typedef.name,))
def slot_tp_setattro(space, w_self, w_name, w_value):
if w_value is not None:
@@ -387,8 +389,7 @@
if getattr_fn is None:
return
- @cpython_api([PyObject, PyObject], PyObject,
- external=external)
+ @cpython_api([PyObject, PyObject], PyObject, header=header)
@func_renamer("cpyext_tp_getattro_%s" % (typedef.name,))
def slot_tp_getattro(space, w_self, w_name):
return space.call_function(getattr_fn, w_self, w_name)
diff --git a/pypy/module/cpyext/test/test_stringobject.py
b/pypy/module/cpyext/test/test_stringobject.py
--- a/pypy/module/cpyext/test/test_stringobject.py
+++ b/pypy/module/cpyext/test/test_stringobject.py
@@ -366,9 +366,3 @@
w_joined = api._PyString_Join(w_sep, w_seq)
assert space.unwrap(w_joined) == 'a<sep>b'
- def test_type(self, space, api):
- py_str = make_ref(space, space.w_str)
- py_unicode = make_ref(space, space.w_unicode)
- py_basestr = make_ref(space, space.w_basestring)
- #import pdb
- #pdb.set_trace()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit