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

Only do the ensure_text() dance on Windows #8666

Merged

Conversation

uranusjr
Copy link
Member

POSIX is problematic when the environment is not configured properly. Fix #8658.

@pradyunsg
Copy link
Member

Not including this in 20.2.1, since it's Python 2 and I'm not super sure I can review this unilaterally. :)

@lkollar
Copy link
Contributor

lkollar commented Oct 27, 2020

Do you think this could be included in the next release? It seems like a fairly straightforward fix and the issue does impact quite a few users.

# errors caused by the environment configuring encodings incorrectly.
if WINDOWS:
encoding = sys.getfilesystemencoding()
rmtree(ensure_text(self._path, encoding=encoding))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have an explicit encoding here when previously we didn't? IMO, we should limit this to the absolute bare minimum change, as we won't ever have a chance to fix any bugs we might introduce (after 20.3, we'll be dropping Python 2 support, and we don't want to introduce new Python 2 bugs just before doing so).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure_text uses utf-8 by default, which is wrong on Windows in most of the cases. But fair enough—nobody has ever reported this, Python 2 is going away, and has enough problems on non-English Windows this probably does not matter.

@uranusjr uranusjr force-pushed the rmtree-unicode-use-file-system-encoding branch from 240ed7d to 5a0118c Compare October 27, 2020 12:41
@pfmoore
Copy link
Member

pfmoore commented Oct 27, 2020

Not merging just yet, this probably needs a rebase once the CI issues are sorted.

POSIX is problematic when the environment is not configured properly.
@uranusjr uranusjr force-pushed the rmtree-unicode-use-file-system-encoding branch from 5a0118c to 94fbb6c Compare October 27, 2020 13:40
@pradyunsg pradyunsg merged commit a0ec4be into pypa:master Oct 27, 2020
@pradyunsg
Copy link
Member

Thanks for the nudge here @lkollar!

@uranusjr uranusjr deleted the rmtree-unicode-use-file-system-encoding branch November 1, 2020 06:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pip 20.2 causes UnicodeDecodeError
4 participants