[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-15 Thread Hynek Schlawack
Hynek Schlawack added the comment: Fixed for 3.2 & default. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset cf1ac0c9e753 by Hynek Schlawack in branch '3.2': #15180: Clarify posixpath.join() error message when mixing str & bytes http://hg.python.org/cpython/rev/cf1ac0c9e753 New changeset 1462b963e5ce by Hynek Schlawack in branch 'default': #15180: Clarify

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-12 Thread Hynek Schlawack
Hynek Schlawack added the comment: I didn’t, because I pulled an Antoine and enjoyed weather, people and Florence. :) I understand it’s okay to apply this towards 3.2 & 3.3 (with the proposed fixes)? 2.7 is not necessary because this problem doesn’t exist there: > os.path.join(b'foo', u'bar

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-03 Thread Hynek Schlawack
Hynek Schlawack added the comment: Cool, I'll finish it up in the sprints on Saturday. -- ___ Python tracker ___ ___ Python-bugs-list

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: This is definitely a motivated change ;-). I would like this re-typed as behavior and applied to 2.7, 3.2, and 3.3. I see the current message as being much like a garbled sentence in the docs that people can only understand if they already understand the back

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-02 Thread Éric Araujo
Éric Araujo added the comment: Patch looks good. Left some comments on Rietveld and +1 to Antoine’s note about quotes :) -- ___ Python tracker ___

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: > If the policy for exception messages, such as it is, documented > somewhere? I think we are quite free to change exception messages, as long as the change is motivated. They are not part of the API definitions, and people shouldn't rely on them (the excepti

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-07-02 Thread Éric Araujo
Éric Araujo added the comment: > This strikes me as a bugfix that does not get backported because code might > depend on > the bug. If the policy for exception messages, such as it is, documented > somewhere? I don’t know if it’s written anywhere, but the rule I follow is that even though ex

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-30 Thread Terry J. Reedy
Terry J. Reedy added the comment: This strikes me as a bugfix that does not get backported because code might depend on the bug. If the policy for exception messages, such as it is, documented somewhere? -- nosy: +terry.reedy ___ Python tracker

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Antoine Pitrou
Antoine Pitrou added the comment: Just a nit, you can use double quotes instead of escaping apostrophes ;) -- nosy: +pitrou ___ Python tracker ___ __

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Hynek Schlawack
Hynek Schlawack added the comment: Here's a fix. It would be nice if it could make for 3.3 final I guess. Tests pass for Linux and OS X. -- keywords: +needs review, patch stage: needs patch -> patch review Added file: http://bugs.python.org/file26156/nicer-error-on-str-bytes-mix.diff

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Nick Coghlan
Nick Coghlan added the comment: Yeah, that should do it - I just hadn't looked at the structure of the code to see how annoying it will be to separate the check out from the if statement. Good use case for PEP 409, too :) -- ___ Python tracker

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Hynek Schlawack
Hynek Schlawack added the comment: Catch TypeError, check whether bytes & str are being mixed, re-raise if not, say something user-friendly if yes? -- nosy: +hynek ___ Python tracker _

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Nick Coghlan
New submission from Nick Coghlan : As seen in #4489, the traceback when mixing str and bytes in os.path.join is rather cryptic and hard to decipher if you've never encountered it before: >>> import os.path >>> os.path.join(b'', '') Traceback (most recent call last): File "", line 1, in Fil