Author: Armin Rigo <[email protected]>
Branch: cffi-1.0
Changeset: r77261:b9b34c957683
Date: 2015-05-09 20:41 +0200
http://bitbucket.org/pypy/pypy/changeset/b9b34c957683/
Log: @edliable fix: can't call _new_function_type() from an elidable
function
diff --git a/pypy/module/_cffi_backend/ffi_obj.py
b/pypy/module/_cffi_backend/ffi_obj.py
--- a/pypy/module/_cffi_backend/ffi_obj.py
+++ b/pypy/module/_cffi_backend/ffi_obj.py
@@ -58,7 +58,7 @@
else:
assert isinstance(x, realize_c_type.W_RawFuncType)
if consider_fn_as_fnptr:
- return x.unwrap_as_fnptr(self)
+ return x.unwrap_as_fnptr_in_elidable()
else:
return x.unexpected_fn_type(self)
@@ -81,6 +81,8 @@
x = realize_c_type.realize_c_type_or_func(
self, self.ctxobj.info.c_output, index)
assert x is not None
+ if isinstance(x, realize_c_type.W_RawFuncType):
+ x.unwrap_as_fnptr(self) # force it here
self.types_dict[string] = x
return self.get_string_to_type(string, consider_fn_as_fnptr)
diff --git a/pypy/module/_cffi_backend/realize_c_type.py
b/pypy/module/_cffi_backend/realize_c_type.py
--- a/pypy/module/_cffi_backend/realize_c_type.py
+++ b/pypy/module/_cffi_backend/realize_c_type.py
@@ -153,6 +153,10 @@
ffi.space, fargs, fret, ellipsis)
return self._ctfuncptr
+ def unwrap_as_fnptr_in_elidable(self):
+ assert self._ctfuncptr is not None
+ return self._ctfuncptr
+
def unwrap_as_nostruct_fnptr(self, ffi):
if self._nostruct_ctfuncptr[0] is None:
fargs, fret, ellipsis = self._unpack(ffi)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit