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

Support non-ascii cwds in make_subprocess_output_error() #6683

Merged

Conversation

cjerdonek
Copy link
Member

@cjerdonek cjerdonek commented Jul 6, 2019

This is a follow-on to PR #6671 to fix another potential Python 2 str issue in PR #6655.

Currently, make_subprocess_output_error() will raise a UnicodeDecodeError like the following when calling str.format() if the cwd contains a non-ascii character:

UnicodeDecodeError: 'ascii' codec can't decode byte ...

This PR fixes that issue by safely converting the cwd to text (unicode in Python 2) before calling str.format(). It does this by introducing a path_to_display() function that is similar to the str_to_display() function introduced in PR #6671, except tailored to paths rather than to general bytes objects.

@cjerdonek cjerdonek added C: encoding Related to text encoding and likely, UnicodeErrors skip news Does not need a NEWS file entry (eg: trivial changes) labels Jul 6, 2019
@cjerdonek cjerdonek force-pushed the make-subprocess-error-path-display branch from bc6f700 to 6c0026f Compare July 6, 2019 07:13
@cjerdonek cjerdonek force-pushed the make-subprocess-error-path-display branch from 6c0026f to 77ad476 Compare July 6, 2019 07:26
@cjerdonek
Copy link
Member Author

Thanks, @xavfernandez.

@cjerdonek cjerdonek merged commit ddfa401 into pypa:master Jul 8, 2019
@cjerdonek cjerdonek deleted the make-subprocess-error-path-display branch July 8, 2019 20:19
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Aug 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: encoding Related to text encoding and likely, UnicodeErrors skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants