Riccardo Schirone <rschi...@redhat.com> added the comment:

The fix for python-2.7 
(https://github.com/python/cpython/pull/13815/files#diff-b577545d73dd0cdb2c337a4c5f89e1d7R183)
 causes errors when netloc contains characters that can't be encoded by 'ascii' 
codec.

You can see it by doing:
>>> netloc = u'example.com\uf...@bing.com'
>>> raise ValueError(u"netloc '" + netloc + u"' contains invalid characters 
>>> under NFKC normalization")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: <exception str() failed>
>>> str(netloc)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\uff03' in position 
11: ordinal not in range(128)

I suggest we use `repr(netloc)` instead of `netloc` in the ValueError message.

----------
nosy: +rschiron

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36742>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to