-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
Error in documentation for "compile" built-in function #70589
Comments
According to the documentation, if the 'compile' built-in function encounters NUL bytes in the compiled source, it raises TypeError, but this is not true: >>> source = '\u0000'
>>> compile(source, '', 'single')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: source code string cannot contain null bytes It raises ValueError, not TypeError. And IMHO, it's the proper exception to raise... |
Here is the patch. |
It would be good to add a versionchanged note. Something like: .. versionchanged:: 3.5 |
I checked the sources at github and the change was introduced back in 2010, if I recall correctly, so maybe this change happened in 3.2? I can check again and try to determine the exact date and if at all possible the version. |
TypeError is raised in 3.4 |
I checked the Mercurial repository directly, and the change was introduced in 2014: http://bugs.python.org/issue22215 So, yes, looks like a 3.5 change and the versionchanged note suggested by Berker is a great idea! |
Updated patch. |
New changeset 0cfac9efd895 by Berker Peksag in branch '3.5': New changeset 45cf82f424ce by Berker Peksag in branch 'default': |
Thanks! |
Thanks to you, Berker, and SilentGhost, for applying and preparing the patch! |
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: