This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年08月17日 14:43 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| valueerror_embedded_nul_character.diff | serhiy.storchaka, 2014年08月17日 14:43 | review | ||
| valueerror_embedded_nul_character_2.patch | serhiy.storchaka, 2014年09月05日 09:50 | review | ||
| valueerror_embedded_nul_character_3.patch | serhiy.storchaka, 2014年09月06日 06:29 | review | ||
| Messages (10) | |||
|---|---|---|---|
| msg225447 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | 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) * (Python committer) | 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) * (Python committer) | Date: 2014年09月05日 07:07 | |
If there are no objections I'll commit the patch soon. |
|||
| msg226410 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | 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) * (Python committer) | 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) * (Python committer) | 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) * (Python committer) | Date: 2014年09月06日 06:21 | |
Simplified a code in getargs.c as suggested by Victor. |
|||
| msg226478 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年09月06日 09:06 | |
The latest patch looks good to me. |
|||
| msg226495 - (view) | Author: Roundup Robot (python-dev) (Python triager) | 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) * (Python committer) | Date: 2014年09月06日 17:30 | |
Thank you for your review Victor. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:07 | admin | set | github: 66411 |
| 2014年09月06日 17:31:30 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2014年09月06日 17:30:58 | serhiy.storchaka | set | messages: + msg226497 |
| 2014年09月06日 17:08:25 | python-dev | set | messages: + msg226495 |
| 2014年09月06日 09:06:57 | vstinner | set | messages: + msg226478 |
| 2014年09月06日 06:29:27 | serhiy.storchaka | set | files: + valueerror_embedded_nul_character_3.patch |
| 2014年09月06日 06:23:08 | serhiy.storchaka | set | files: - valueerror_embedded_nul_character_3.patch |
| 2014年09月06日 06:21:39 | serhiy.storchaka | set | files:
+ valueerror_embedded_nul_character_3.patch messages: + msg226472 |
| 2014年09月05日 09:50:37 | serhiy.storchaka | set | files:
+ valueerror_embedded_nul_character_2.patch messages: + msg226413 |
| 2014年09月05日 08:57:48 | vstinner | set | messages: + msg226411 |
| 2014年09月05日 08:56:51 | vstinner | set | nosy:
+ vstinner messages: + msg226410 |
| 2014年09月05日 07:07:03 | serhiy.storchaka | set | messages: + msg226403 |
| 2014年08月30日 20:59:51 | r.david.murray | set | messages: - msg226149 |
| 2014年08月30日 20:57:29 | python-dev | set | nosy:
+ python-dev messages: + msg226149 |
| 2014年08月19日 07:02:46 | serhiy.storchaka | set | assignee: serhiy.storchaka |
| 2014年08月19日 07:02:20 | serhiy.storchaka | set | messages: + msg225518 |
| 2014年08月17日 14:43:54 | serhiy.storchaka | create | |