http://bugs.python.org/review/15180/diff/5242/Lib/posixpath.py
File Lib/posixpath.py (right):
http://bugs.python.org/review/15180/diff/5242/Lib/posixpath.py#newcode88
Lib/posixpath.py:88: raise TypeError('You can\'t mix strings and bytes in path '
On 2012/07/02 22:11:25, eric.araujo wrote:
> Minor: I don’t remember error messages using “you”, more often “impossible to
X”
> or “can't X”
You’re right, I still suck at copywriting. Fixing.
http://bugs.python.org/review/15180/diff/5242/Lib/posixpath.py#newcode89
Lib/posixpath.py:89: 'components.') from None
On 2012/07/02 22:11:25, eric.araujo wrote:
> I like error messages that tell which argument has a bad type or value.
Me too, but you don’t really know in this case which one was the intended one…I
think it’s better to have the user have a look at it. At least they know now why
it’s happening. :)
http://bugs.python.org/review/15180/diff/5242/Lib/test/test_posixpath.py
File Lib/test/test_posixpath.py (right):
http://bugs.python.org/review/15180/diff/5242/Lib/test/test_posixpath.py#newc...
Lib/test/test_posixpath.py:61: try:
On 2012/07/02 22:11:25, eric.araujo wrote:
> This should fail if the exception is not raised. Instead of recommending
> try/except/else, I advise just using assertRaises, and also not testing for
the
> exact error message (which Python does not guarantee).
Then I wouldn’t have to add any tests at all, because we get TypeError already.
The point of the patch is to make it more readable. :)
Issue 15180: Cryptic traceback from os.path.join when mixing str & bytes
Created 11 months ago by Nick Coghlan
Modified 10 months, 1 week ago
Reviewers: eric.araujo, hynek
Base URL: None
Comments: 6