[pypy-commit] pypy api_func-refactor: Returning an ApiFunction object from _create_api_func() seems to make more sense
rlamy
pypy.commits at gmail.com
Mon Jan 9 15:31:49 EST 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: api_func-refactor
Changeset: r89457:1106b7b9f614
Date: 2017-01-09 20:31 +0000
http://bitbucket.org/pypy/pypy/changeset/1106b7b9f614/
Log: Returning an ApiFunction object from _create_api_func() seems to
make more sense
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
@@ -447,9 +447,12 @@
else:
c_name = func.__name__
- unwrapper = _create_api_func(
+ api_function = _create_api_func(
func, argtypes, restype, error, c_name, gil, result_borrowed,
result_is_ll)
+ unwrapper = api_function.get_unwrapper()
+ unwrapper.func = func
+ unwrapper.api_func = api_function
# ZZZ is this whole logic really needed??? It seems to be only
# for RPython code calling PyXxx() functions directly. I would
@@ -473,7 +476,7 @@
return res
if header is not None:
- FUNCTIONS_BY_HEADER[header][func.__name__] = unwrapper.api_func
+ FUNCTIONS_BY_HEADER[header][func.__name__] = api_function
INTERPLEVEL_API[func.__name__] = unwrapper_catch # used in tests
return unwrapper
return decorate
@@ -495,14 +498,9 @@
error = rffi.cast(real_restype, error)
func._always_inline_ = 'try'
- api_function = ApiFunction(argtypes, restype, func, error,
- c_name=c_name, gil=gil,
- result_borrowed=result_borrowed,
- result_is_ll=result_is_ll)
- unwrapper = api_function.get_unwrapper()
- unwrapper.func = func
- unwrapper.api_func = api_function
- return unwrapper
+ return ApiFunction(
+ argtypes, restype, func, error, c_name=c_name, gil=gil,
+ result_borrowed=result_borrowed, result_is_ll=result_is_ll)
def cpython_struct(name, fields, forward=None, level=1):
More information about the pypy-commit
mailing list