Skip to content

Commit ef5c47d

Browse files
address code review
1 parent 1539483 commit ef5c47d

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

Python/optimizer_bytecodes.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,8 +1241,9 @@ dummy_func(void) {
12411241
if (total_args == 1 && PyCFunction_GET_FLAGS(callable_o) == METH_O) {
12421242
ADD_OP(_NOP, 0, 0);
12431243
}
1244+
} else {
1245+
sym_set_type(callable, &PyCFunction_Type);
12441246
}
1245-
sym_set_type(callable, &PyCFunction_Type);
12461247
}
12471248

12481249
op(_GUARD_CALLABLE_BUILTIN_FAST, (callable, unused, unused[oparg] -- callable, unused, unused[oparg])) {
@@ -1251,8 +1252,9 @@ dummy_func(void) {
12511252
if (PyCFunction_GET_FLAGS(callable_o) == METH_FASTCALL) {
12521253
ADD_OP(_NOP, 0, 0);
12531254
}
1255+
} else {
1256+
sym_set_type(callable, &PyCFunction_Type);
12541257
}
1255-
sym_set_type(callable, &PyCFunction_Type);
12561258
}
12571259

12581260
op(_GUARD_CALLABLE_BUILTIN_FAST_WITH_KEYWORDS, (callable, unused, unused[oparg] -- callable, unused, unused[oparg])) {
@@ -1261,8 +1263,9 @@ dummy_func(void) {
12611263
if (PyCFunction_GET_FLAGS(callable_o) == (METH_FASTCALL | METH_KEYWORDS)) {
12621264
ADD_OP(_NOP, 0, 0);
12631265
}
1266+
} else {
1267+
sym_set_type(callable, &PyCFunction_Type);
12641268
}
1265-
sym_set_type(callable, &PyCFunction_Type);
12661269
}
12671270

12681271
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res, c, s)) {
@@ -1299,8 +1302,9 @@ dummy_func(void) {
12991302
self && Py_IS_TYPE(self, d_type)) {
13001303
ADD_OP(_NOP, 0, 0);
13011304
}
1305+
} else {
1306+
sym_set_type(callable, &PyMethodDescr_Type);
13021307
}
1303-
sym_set_type(callable, &PyMethodDescr_Type);
13041308
}
13051309

13061310
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
@@ -1322,8 +1326,9 @@ dummy_func(void) {
13221326
self && Py_IS_TYPE(self, d_type)) {
13231327
ADD_OP(_NOP, 0, 0);
13241328
}
1329+
} else {
1330+
sym_set_type(callable, &PyMethodDescr_Type);
13251331
}
1326-
sym_set_type(callable, &PyMethodDescr_Type);
13271332
}
13281333

13291334
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_NOARGS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
@@ -1345,8 +1350,9 @@ dummy_func(void) {
13451350
self && Py_IS_TYPE(self, d_type)) {
13461351
ADD_OP(_NOP, 0, 0);
13471352
}
1353+
} else {
1354+
sym_set_type(callable, &PyMethodDescr_Type);
13481355
}
1349-
sym_set_type(callable, &PyMethodDescr_Type);
13501356
}
13511357

13521358
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
@@ -1368,8 +1374,9 @@ dummy_func(void) {
13681374
self && Py_IS_TYPE(self, d_type)) {
13691375
ADD_OP(_NOP, 0, 0);
13701376
}
1377+
} else {
1378+
sym_set_type(callable, &PyMethodDescr_Type);
13711379
}
1372-
sym_set_type(callable, &PyMethodDescr_Type);
13731380
}
13741381

13751382
op(_CALL_METHOD_DESCRIPTOR_O, (callable, self_or_null, args[oparg] -- res, c, s, a)) {

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)