-
-
Notifications
You must be signed in to change notification settings - Fork 32k
"embedded NUL character" exceptions #66411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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. |
BDFL have approved the idea (http://permalink.gmane.org/gmane.comp.python.devel/149000). Could anyone please make the review of concrete patch? |
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"): I talking about the error message because you changed it in a few places. |
Thank you Victor. Here is a patch which is synchronized with the tip and addresses your comment about a null character. |
Simplified a code in getargs.c as suggested by Victor. |
The latest patch looks good to me. |
New changeset 25032ec29315 by Serhiy Storchaka in branch 'default': |
Thank you for your review Victor. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: