{{! Copyright (c) Meta Platforms, Inc. and affiliates. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. }} client, pyfuture, options = userdata {{! so client lives on until we exit }} if {{#function:exceptions}}{{! }}result.hasException[{{#field:type}}{{> types/cython_cpp_type}}{{/field:type}}](): {{#field:type}} try: exc = {{> types/cython_python_type}}._create_FBTHRIFT_ONLY_DO_NOT_USE(try_make_shared_exception[{{> types/cython_cpp_type}}](result.exception())) except Exception as ex: {{! This is probably a UnicodeDecodeError }} pyfuture.set_exception(ex.with_traceback(None)) else: pyfuture.set_exception(exc) {{/field:type}} elif {{/function:exceptions}}{{! }}result.hasException(): pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) else: try: pyfuture.set_result({{#function:return_type}}{{> clients/cython_cpp_value_to_return_value}}{{/function:return_type}}) except Exception as ex: {{! Most likely this is only ever unicode decode errors }} pyfuture.set_exception(ex.with_traceback(None))