summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2023-06-29 20:49:54 (GMT)
committerGitHub <noreply@github.com>2023-06-29 20:49:54 (GMT)
commit7b2d94d87513967b357c658c6e7e1b8c8d02487d (patch)
treebdd79e2c20b235f3d4c1272c8c8e2f1880bfb129 /Lib/dis.py
parent6e9f83d9aee34192de5d0ef7285be23514911ccd (diff)
downloadcpython-7b2d94d87513967b357c658c6e7e1b8c8d02487d.zip
cpython-7b2d94d87513967b357c658c6e7e1b8c8d02487d.tar.gz
cpython-7b2d94d87513967b357c658c6e7e1b8c8d02487d.tar.bz2
GH-106008: Make implicit boolean conversions explicit (GH-106003)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index f135a0b..f7a31f2 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -572,8 +572,10 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
elif deop in haslocal or deop in hasfree:
argval, argrepr = _get_name_info(arg, varname_from_oparg)
elif deop in hascompare:
- argval = cmp_op[arg>>4]
+ argval = cmp_op[arg >> 5]
argrepr = argval
+ if arg & 16:
+ argrepr = f"bool({argrepr})"
elif deop == CONVERT_VALUE:
argval = (None, str, repr, ascii)[arg]
argrepr = ('', 'str', 'repr', 'ascii')[arg]