msg225447 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-08-17 14:43 |
Currently most functions which accepts string only without embedded NUL character, raise TypeError. Proposed patch change exception type to more consistent ValueError. It also unifies error messages. I have opened a discussion on Python-Dev. |
|
|
msg225518 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-08-19 07:02 |
BDFL have approved the idea (http://permalink.gmane.org/gmane.comp.python.devel/149000). Could anyone please make the review of concrete patch? |
|
|
msg226403 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-09-05 07:07 |
If there are no objections I'll commit the patch soon. |
|
|
msg226410 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2014-09-05 08:56 |
> If there are no objections I'll commit the patch soon. Replacing TypeError with ValueError is fine. TypeError was a bad choice. If an application relies on TypeError to check for null character, it's easy to replace "except TypeError:" with "except (TypeError, ValueError):" to stay compatible with Python < 3.5. Instead of "NUL character" (and "NUL byte), I had prefer "null character" (and "null byte"): http://en.wikipedia.org/wiki/Null_character I talking about the error message because you changed it in a few places. |
|
|
msg226411 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2014-09-05 08:57 |
You may also take a look at these 2 issues: #13617 and #21147 (not directly related to this oe). |
|
|
msg226413 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-09-05 09:50 |
Thank you Victor. Here is a patch which is synchronized with the tip and addresses your comment about a null character. |
|
|
msg226472 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-09-06 06:21 |
Simplified a code in getargs.c as suggested by Victor. |
|
|
msg226478 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2014-09-06 09:06 |
The latest patch looks good to me. |
|
|
msg226495 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2014-09-06 17:08 |
New changeset 25032ec29315 by Serhiy Storchaka in branch 'default': Issue #22215: Now ValueError is raised instead of TypeError when str or bytes http://hg.python.org/cpython/rev/25032ec29315 |
|
|
msg226497 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-09-06 17:30 |
Thank you for your review Victor. |
|
|