Skip to content

Commit 07671f8

Browse files
committed
MARK in grey
1 parent 35d1088 commit 07671f8

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

Lib/_colorize.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ class Pickletools(ThemeSection):
367367
mark: str = ANSIColors.GREY
368368
op_call: str = ANSIColors.GREEN
369369
op_container: str = ANSIColors.INTENSE_BLUE
370-
op_literal: str = ANSIColors.CYAN
371370
op_memo: str = ANSIColors.MAGENTA
372371
op_meta: str = ANSIColors.GREY
373372
op_stack: str = ANSIColors.BOLD_RED

Lib/pickletools.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,19 +2405,12 @@ def optimize(p):
24052405
"EMPTY_SET", "EMPTY_TUPLE", "FROZENSET", "LIST", "SETITEM",
24062406
"SETITEMS", "TUPLE", "TUPLE1", "TUPLE2", "TUPLE3",
24072407
}),
2408-
op_literal=frozenset({
2409-
"BINBYTES", "BINBYTES8", "BINFLOAT", "BININT", "BININT1", "BININT2",
2410-
"BINSTRING", "BINUNICODE", "BINUNICODE8", "BYTEARRAY8", "FLOAT",
2411-
"INT", "LONG", "LONG1", "LONG4", "NEWFALSE", "NEWTRUE", "NEXT_BUFFER",
2412-
"NONE", "READONLY_BUFFER", "SHORT_BINBYTES", "SHORT_BINSTRING",
2413-
"SHORT_BINUNICODE", "STRING", "UNICODE",
2414-
}),
24152408
op_memo=frozenset({
24162409
"BINGET", "BINPUT", "GET", "LONG_BINGET", "LONG_BINPUT", "MEMOIZE",
24172410
"PUT",
24182411
}),
2419-
op_meta=frozenset({"BINPERSID", "FRAME", "PERSID", "PROTO"}),
2420-
op_stack=frozenset({"DUP", "MARK", "POP", "POP_MARK", "STOP"}),
2412+
op_meta=frozenset({"BINPERSID", "FRAME", "MARK", "PERSID", "PROTO"}),
2413+
op_stack=frozenset({"DUP", "POP", "POP_MARK", "STOP"}),
24212414
)
24222415
_opcode_color_attr = frozendict({
24232416
name: attr
@@ -2482,13 +2475,13 @@ def dis(pickle, out=None, memo=None, indentlevel=4, annotate=0):
24822475
if pos is not None:
24832476
print(f"{t.position}{pos:5d}:{t.reset}", end=' ', file=out)
24842477

2485-
opcode_color = getattr(
2486-
t, _opcode_color_attr.get(opcode.name, "op_meta")
2487-
)
2478+
attr = _opcode_color_attr.get(opcode.name)
2479+
opcode_color = getattr(t, attr) if attr else ""
2480+
opcode_reset = t.reset if attr else ""
24882481
line = (
24892482
f"{t.opcode_code}{repr(opcode.code)[1:-1]:<4}{t.reset} "
24902483
f"{indentchunk * len(markstack)}"
2491-
f"{opcode_color}{opcode.name}{t.reset}"
2484+
f"{opcode_color}{opcode.name}{opcode_reset}"
24922485
)
24932486

24942487
maxproto = max(maxproto, opcode.proto)

0 commit comments

Comments
 (0)