Author: Armin Rigo <[email protected]>
Branch: share-cpyext-cpython-api
Changeset: r84077:d520d25aa845
Date: 2016-05-01 08:19 +0200
http://bitbucket.org/pypy/pypy/changeset/d520d25aa845/
Log: ignore 'result_borrowed' if 'result_is_ll', also for the purposes of
sharing
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
@@ -727,10 +727,16 @@
assert not error_value # only support error=NULL
error_value = 0 # because NULL is not hashable
+ if callable.api_func.result_is_ll:
+ result_kind = "L"
+ elif callable.api_func.result_borrowed:
+ result_kind = "B" # note: 'result_borrowed' is ignored if we also
+ else: # say 'result_is_ll=True' (in this case it's
+ result_kind = "." # up to you to handle refcounting anyway)
+
signature = (tuple(argtypesw),
callable.api_func.restype,
- callable.api_func.result_borrowed,
- callable.api_func.result_is_ll,
+ result_kind,
error_value,
gil)
@@ -780,7 +786,7 @@
assert False
def make_wrapper_second_level(space, callable2name, argtypesw, restype,
- result_borrowed, result_is_ll, error_value, gil):
+ result_kind, error_value, gil):
from rpython.rlib import rgil
argtypes_enum_ui = unrolling_iterable(enumerate(argtypesw))
fatal_value = restype._defl()
@@ -885,12 +891,12 @@
elif is_PyObject(restype):
if is_pyobj(result):
- if not result_is_ll:
+ if result_kind != "L":
raise invalid("missing result_is_ll=True")
else:
- if result_is_ll:
+ if result_kind == "L":
raise invalid("result_is_ll=True but not ll PyObject")
- if result_borrowed:
+ if result_kind == "B": # borrowed
result = as_pyobj(space, result)
else:
result = make_ref(space, result)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit