Skip to content

Commit 29311d8

Browse files
committed
review comments
1 parent ba88f27 commit 29311d8

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

Python/optimizer_bytecodes.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,14 +538,15 @@ dummy_func(void) {
538538
op(_TO_BOOL, (value -- res)) {
539539
int already_bool = optimize_to_bool(this_instr, ctx, value, &res, false);
540540
if (!already_bool) {
541-
if (sym_matches_type(value, &PyDict_Type)) {
541+
PyTypeObject *tp = sym_get_type(value);
542+
if (tp == &PyDict_Type) {
542543
REPLACE_OP(this_instr, _TO_BOOL_DICT, 0, 0);
543544
}
544-
else if (sym_matches_type(value, &PyTuple_Type) ||
545-
sym_matches_type(value, &PySet_Type) ||
546-
sym_matches_type(value, &PyFrozenSet_Type) ||
547-
sym_matches_type(value, &PyBytes_Type) ||
548-
sym_matches_type(value, &PyByteArray_Type)) {
545+
else if (tp == &PyTuple_Type ||
546+
tp == &PySet_Type ||
547+
tp == &PyFrozenSet_Type ||
548+
tp == &PyBytes_Type ||
549+
tp == &PyByteArray_Type) {
549550
REPLACE_OP(this_instr, _TO_BOOL_SIZED, 0, 0);
550551
}
551552
res = sym_new_truthiness(ctx, value, true);

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)