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

This helps finding packages with bad utf #537

Merged
merged 1 commit into from Apr 7, 2016

Conversation

Projects
None yet
2 participants
@ri0t
Contributor

ri0t commented Apr 7, 2016

Checking hundreds of possibly installed packages manually should NOT be expected of the user ;)

riot
This helps finding packages with bad utf
Checking hundreds of possibly installed packages manually should NOT be expected of the user ;)
@jaraco

This comment has been minimized.

Member

jaraco commented Apr 7, 2016

Excellent. Thanks for the contrib.

One concern I have - what if there are clients relying on the UnicodeDecodeError to trap such exceptions? Perhaps that's unlikely and this would be safe. Let's roll it out and see.

Also, I feel a little dirty evaluating str(exc) and then raising a new exception. Given that Python 3 has built-in exception chaining, I'm more inclined to go with a simple raise Exception("Invalid encoding on package metadata %s" % self.path) and let the user re-run the decoding on Python 2 if they need to trace the invalid characters.

@jaraco jaraco merged commit 06eae67 into pypa:master Apr 7, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

jaraco added a commit that referenced this pull request Apr 7, 2016

Instead of reasing a new exception, just augment the existing excepti…
…on, avoiding any concerns about exception type, but still communicating the context necessary to trace the issue. Ref #537.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment