[webkit-changes] [WebKit/WebKit] c47402: webkitcorepy.Terminal should allow any file-like o...

Sam Sneddon noreply at github.com
Tue Dec 3 11:38:55 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c4740203d5eeb2b1f146db2d26fdbb4685f6c3ff
      https://github.com/WebKit/WebKit/commit/c4740203d5eeb2b1f146db2d26fdbb4685f6c3ff
  Author: Sam Sneddon <gsnedders at apple.com>
  Date:   2024-12-03 (Tue, 03 Dec 2024)

  Changed paths:
    M Tools/Scripts/libraries/webkitcorepy/webkitcorepy/terminal.py
    M Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/terminal_unittest.py

  Log Message:
  -----------
  webkitcorepy.Terminal should allow any file-like object
https://bugs.webkit.org/show_bug.cgi?id=283250

Reviewed by Jonathan Bedard.

Previously, we strictly required arguments to
Terminal.assert_writeable_stream and Terminal.override_atty to be
specific types of file-like objects (specifically: those inheriting
from io.IOBase, as on Python 3 all three options are either io.IOBase
or subclasses thereof).

This unfortunately means that they then throw when passed another
file-like object (e.g., something inheriting from the typing.IO ABC).

The status of file-like objects in the Python system is a bit of a
mess, and requiring them to be specific types is almost certainly
unworkable, thus we should just rely on duck-typing and checking we
have something that looks like a file-like object.

* Tools/Scripts/libraries/webkitcorepy/webkitcorepy/terminal.py:
(Terminal.assert_writeable_stream):
(Terminal.override_atty):
* Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/terminal_unittest.py:
(TerminalTests.test_interrupt_decorator):
(TerminalTests):
(TerminalTests.test_assert_writeable_stream):
(TerminalTests.test_override_atty):

Canonical link: https://commits.webkit.org/287299@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list