MCPcopy Index your code
hub / github.com/python/mypy / set_target

Method set_target

mypyc/codegen/emitwrapper.py:852–869  ·  view source on GitHub ↗

Set the wrapped function. It's fine to modify the attributes initialized here later to customize the wrapper function.

(self, fn: FuncIR)

Source from the content-addressed store, hash-verified

850 self.traceback_code = ""
851
852 def set_target(self, fn: FuncIR) -> None:
853 """Set the wrapped function.
854
855 It's fine to modify the attributes initialized here later to customize
856 the wrapper function.
857 """
858 self.target_name = fn.name
859 self.target_cname = fn.cname(self.emitter.names)
860 # Cached native-call expression so cross-group targets go through the
861 # exports table; same as `NATIVE_PREFIX + cname` for in-group calls.
862 self.target_native_call = self.emitter.native_function_call(fn.decl)
863 self.num_bitmap_args = fn.sig.num_bitmap_args
864 if self.num_bitmap_args:
865 self.args = fn.args[: -self.num_bitmap_args]
866 else:
867 self.args = fn.args
868 self.arg_names = [arg.name for arg in self.args]
869 self.ret_type = fn.ret_type
870
871 def wrapper_name(self) -> str:
872 """Return the name of the wrapper function."""

Callers 5

generate_dunder_wrapperFunction · 0.95
generate_ipow_wrapperFunction · 0.95
generate_bin_op_wrapperFunction · 0.95
generate_wrapper_coreFunction · 0.95

Calls 2

native_function_callMethod · 0.80
cnameMethod · 0.45

Tested by

no test coverage detected