Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid UnicodeDecodeError from command output #2970

Merged
merged 2 commits into from
Apr 5, 2023

Commits on Apr 3, 2023

  1. test_sync_write_decode_surrogate: utf-8 decode

    When SyncWrite decodes bytes as utf-8, it should replace unknown
    sequences with the unicode surrogate codepoint instead of crashing the
    program.
    
    Test case for tox-dev#2969
    masenf committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    7113234 View commit details
    Browse the repository at this point in the history
  2. SyncWrite: decode with errors='surrogateescape'

    Avoid bubbling UnicodeDecodeError up from stream handling internals.
    
    Tox has no way of knowing that the bytestream emitted by a command will
    be valid utf-8, even if utf-8 is ostensibly the "correct" encoding for
    the stream. It's always possible for an arbitrary command to return
    non-utf-8 bytes, and this situation should not break tox.
    
    Fix tox-dev#2969
    masenf committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    c4fdf2c View commit details
    Browse the repository at this point in the history