Skip to content

Commit

Permalink
fix: assert existence of stderr
Browse files Browse the repository at this point in the history
Needed to make the mypy be quiet about the ‹fileno()› on possibly ‹None›.

Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Oct 30, 2024
1 parent d7076c4 commit 1a0010d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions specfile/context_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def capture_stderr() -> Generator[List[bytes], None, None]:
Yields:
List of captured lines.
"""
assert sys.__stderr__, "stderr should exist"
fileno = sys.__stderr__.fileno()
with tempfile.TemporaryFile() as stderr, os.fdopen(os.dup(fileno)) as backup:
sys.stderr.flush()
Expand Down

0 comments on commit 1a0010d

Please sign in to comment.