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

Simplify away safe_text_dupfile/EncodedFile #6875

Closed
wants to merge 1 commit into from

Commits on Mar 7, 2020

  1. Simplify away safe_text_dupfile/EncodedFile

    I tried to understand what the `safe_text_dupfile()` function and
    `EncodedFile` class do. Outside tests, `EncodedFile` is only used by
    `safe_text_dupfile`, and `safe_text_dupfile` is only used by
    `FDCaptureBinary.__init__()`. I then started to eliminate always-true
    conditions based on the single call site, and in the end nothing was
    left.
    
    The old code had some workarounds:
    
    - Ensure `errors` property is set: pytest-dev#555.
      It is set now, although now it will return `replace`, which is the
      actual method used also before, instead of `strict`. AFAIU, the issue
      just wanted it to be set to something, not `strict` specifically.
    
    - Infinite recursion trying to pickle `EncodedFile` (f7282b8).
      Not sure, I don't think this object should be pickle-able at all (and
      it isn't...).
    
    - A bug in `logging.Handler.__repr__` with int `file.name`.
      pytest-dev#2555
      Was fixed in Python>=3.7.4: https://bugs.python.org/issue36015.
      TODO: This workaround is probably still needed?
    bluetech committed Mar 7, 2020
    Configuration menu
    Copy the full SHA
    60f5531 View commit details
    Browse the repository at this point in the history