Skip to content

Commit 82c0822

Browse files
committed
Fix GhostScript error handling types
The stack variable should default to bytes, not str, which we can compress into a single statement for clarity.
1 parent 6f1be17 commit 82c0822

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/matplotlib/testing/compare.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ def encode_and_escape(name):
136136
self._proc.stdin.flush()
137137
# GS> if nothing left on the stack; GS<n> if n items left on the stack.
138138
err = self._read_until((b"GS<", b"GS>"))
139-
stack = ""
140-
if err.endswith(b"GS<"):
141-
stack = self._read_until(b">")
139+
stack = self._read_until(b">") if err.endswith(b"GS<") else b""
142140
if stack or not os.path.exists(dest):
143141
stack_size = int(stack[:-1]) if stack else 0
144142
self._proc.stdin.write(b"pop\n" * stack_size)

0 commit comments

Comments
 (0)