Skip to content
Myr

BUG/TST: fix a race in `click.testing.StreamMixer`'s finalization, seen in a multi-threaded context

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Clément Robert · committed by Clément Robert · parent 565f36d · Browse files · 1 file+12 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−0 removed

  • other:+12 added−0 removed

1 file+12 added−0 removed

modified:src/click/testing.py+12 added
97 unmodified lines
98 self.output: io.BytesIO = io.BytesIO()99 self.stdout: io.BytesIO = BytesIOCopy(copy_to=self.output)100 self.stderr: io.BytesIO = BytesIOCopy(copy_to=self.output)101102 def __del__(self) -> None:103 """104 Guarantee that embedded file-like objects are closed in a105 predictable order, protecting against races between106 self.output being closed and other streams being flushed on close107108 .. versionadded:: 8.2.2109 """110 self.stderr.close()111 self.stdout.close()112 self.output.close()113114115class _NamedTextIOWrapper(io.TextIOWrapper):116 def __init__(117 self, buffer: t.BinaryIO, name: str, mode: str, **kwargs: t.Any118 ) -> None:
459 unmodified lines