Skip to content

Commit 4c614a0

Browse files
Guard against booleans in unary_invert
1 parent 55d098f commit 4c614a0

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

Python/optimizer_bytecodes.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ dummy_func(void) {
413413
}
414414

415415
op(_UNARY_INVERT, (value -- res)) {
416-
REPLACE_OPCODE_IF_EVALUATES_PURE(value);
416+
if (!sym_matches_type(value, &PyBool_Type)) {
417+
REPLACE_OPCODE_IF_EVALUATES_PURE(value);
418+
}
417419
if (sym_matches_type(value, &PyLong_Type)) {
418420
res = sym_new_type(ctx, &PyLong_Type);
419421
}

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)