Skip to content

Commit ef5b7c8

Browse files
Address PR comments
1 parent fc293dc commit ef5b7c8

File tree

3 files changed

+118
-114
lines changed

3 files changed

+118
-114
lines changed

Python/optimizer_bytecodes.c

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

415415
op(_UNARY_INVERT, (value -- res)) {
416+
// Required to avoid a warning due to the deprecation of bitwise inversion of bools
416417
if (!sym_matches_type(value, &PyBool_Type)) {
417418
REPLACE_OPCODE_IF_EVALUATES_PURE(value);
418419
}
@@ -425,6 +426,8 @@ dummy_func(void) {
425426
}
426427

427428
op(_COMPARE_OP, (left, right -- res)) {
429+
// Comparison between bytes and str or int is not impacted by this optimization as bytes
430+
// is not a safe type (due to its ability to raise a warning during comparisons).
428431
REPLACE_OPCODE_IF_EVALUATES_PURE(left, right);
429432
if (oparg & 16) {
430433
res = sym_new_type(ctx, &PyBool_Type);

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)