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

Unhandled exception in unicode_utils #486

Closed
bb-migration opened this Issue Jan 21, 2016 · 2 comments

Comments

Projects
None yet
1 participant
@bb-migration

bb-migration commented Jan 21, 2016

Originally reported by: bra (Bitbucket: bra, GitHub: bra)


Hi,

According to the python docs, sys.getfilesystemencoding() can return None.
But the code here:
https://bitbucket.org/pypa/setuptools/src/cf547c694dc5a4f51623e4c5f944322ef9093e16/setuptools/unicode_utils.py?at=default&fileviewer=file-view-default#unicode_utils.py-31
gets TypeError instead of UnicodeDecodeError if None is supplied:

Python 2.7.11 (default, Dec 20 2015, 01:15:21) 
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> 'test'.decode(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: decode() argument 1 must be string, not None

Which doesn't handled, so the code fails on it when sys.getfilesystemencoding() is None.


@bb-migration

This comment has been minimized.

bb-migration commented Jan 24, 2016

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Add test capturing failure. Ref #486.

@bb-migration

This comment has been minimized.

bb-migration commented Jan 24, 2016

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Avoid TypeError when getfilesystemencoding returns None. Fixes #486.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment