python/cpython#99944 is fixed but never backported to Python 3.11 etc
below is the patch file if anyone needs it
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -364,4 +364,3 @@ def _get_const_value(op, arg, co_consts):
argval = UNKNOWN
- if op == LOAD_CONST:
- if co_consts is not None:
- argval = co_consts[arg]
+ if co_consts is not None:
+ argval = co_consts[arg]
return argval