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,
)
| 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, |
no test coverage detected