MCPcopy Create free account
hub / github.com/python/mypy / py_method_call

Method py_method_call

mypyc/irbuild/ll_builder.py:1213–1236  ·  view source on GitHub ↗

Call a Python method (non-native and slow).

(
        self,
        obj: Value,
        method_name: str,
        arg_values: list[Value],
        line: int,
        arg_kinds: list[ArgKind] | None,
        arg_names: Sequence[str | None] | None,
    )

Source from the content-addressed store, hash-verified

1211 return Integer(0, object_rprimitive)
1212
1213 def py_method_call(
1214 self,
1215 obj: Value,
1216 method_name: str,
1217 arg_values: list[Value],
1218 line: int,
1219 arg_kinds: list[ArgKind] | None,
1220 arg_names: Sequence[str | None] | None,
1221 ) -> Value:
1222 """Call a Python method (non-native and slow)."""
1223 result = self._py_vector_method_call(
1224 obj, method_name, arg_values, line, arg_kinds, arg_names
1225 )
1226 if result is not None:
1227 return result
1228
1229 if arg_kinds is None or all(kind == ARG_POS for kind in arg_kinds):
1230 # Use legacy method call API
1231 method_name_reg = self.load_str(method_name)
1232 return self.call_c(py_method_call_op, [obj, method_name_reg] + arg_values, line)
1233 else:
1234 # Use py_call since it supports keyword arguments (and vectorcalls).
1235 method = self.py_get_attr(obj, method_name, line)
1236 return self.py_call(method, arg_values, line, arg_kinds=arg_kinds, arg_names=arg_names)
1237
1238 def _py_vector_method_call(
1239 self,

Callers 2

gen_method_callMethod · 0.95
gen_glue_methodFunction · 0.80

Calls 6

load_strMethod · 0.95
call_cMethod · 0.95
py_get_attrMethod · 0.95
py_callMethod · 0.95
allFunction · 0.85

Tested by

no test coverage detected