Skip to content

Commit b436dd0

Browse files
Cover _EXPAND_METHOD_KW as well
1 parent c5d5d75 commit b436dd0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Python/optimizer_bytecodes.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,18 @@ dummy_func(void) {
11041104
}
11051105
}
11061106

1107+
op(_EXPAND_METHOD_KW, (callable, self_or_null, unused[oparg], unused -- callable, self_or_null, unused[oparg], unused)) {
1108+
if (sym_is_const(ctx, callable) && sym_matches_type(callable, &PyMethod_Type)) {
1109+
PyMethodObject *method = (PyMethodObject *)sym_get_const(ctx, callable);
1110+
callable = sym_new_const(ctx, method->im_func);
1111+
self_or_null = sym_new_const(ctx, method->im_self);
1112+
}
1113+
else {
1114+
callable = sym_new_not_null(ctx);
1115+
self_or_null = sym_new_not_null(ctx);
1116+
}
1117+
}
1118+
11071119
op(_MAYBE_EXPAND_METHOD, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
11081120
(void)args;
11091121
callable = sym_new_not_null(ctx);

Python/optimizer_cases.c.h

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)