pitrou commented on a change in pull request #10581: URL: https://github.com/apache/arrow/pull/10581#discussion_r662367890
########## File path: python/pyarrow/compute.py ########## @@ -197,16 +215,13 @@ def _wrap_function(name, func): args_sig = ', '.join(arg_names) kwonly = '' if arg_names[-1].startswith('*') else ', *' - # Generate templated wrapper, so that the signature matches - # the documented argument names. - ns = {} - if option_class is not None: - template = _wrapper_options_template - else: - template = _wrapper_template - exec(template.format(func_name=name, args_sig=args_sig, kwonly=kwonly), - globals(), ns) - wrapper = ns['make_wrapper'](func, option_class) + # We make a generic wrapper with a simple argument-handling + # machinery, but we also add a __wrapped__ attribute pointing + # to a dummy callable with the desired signature for introspection + # and documentation. + wrapper = _make_generic_wrapper(name, func, option_class) + wrapper.__wrapped__ = _make_dummy_equivalent(args_sig, kwonly, + option_class) Review comment: Ok, it worked with `__signature__`. Thanks for the suggestion! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org