forked from pytest-dev/pytest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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?
- Loading branch information
Showing
2 changed files
with
8 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters