GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-142411: Change documentation to reflect the new docstring adjustments in 3.13 by decorator-factory · Pull Request #142413 · python/cpython Conversation
|
| indented less should not occur, but if they occur all their leading whitespace | ||
| should be stripped. Equivalence of whitespace should be tested after expansion | ||
| of tabs (to 8 spaces, normally). | ||
| The Python parser strips indentation from multi-line string literals when they |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
TIL!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| - :exc:`SyntaxError` if the compiled source is invalid | ||
| - :exc:`ValueError` if the source contains null bytes | ||
| - :exc:`UnicodeDecodeError` if the source code contains docstrings that |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't try to keep this list precise and complete. The exceptions change over time, and it's not like people are going to write except blocks for these specific exceptions. Details are in the versionchanged blocks below. Here can we say that SyntaxError happens if the source is invalid, and other exceptions if the text can't be read in various ways?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I now changed the description to this:
This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled source is invalid.
To summarize some things about compile's interface:
bytes object or a str object), SyntaxError is raised since Python 3.11, and not ValueError, contrary to current documentation.ast.Module, null bytes and surrogates seem to be allowed (but lead to bizzarre behaviour)bytes, SyntaxError will be raise if the source is encoded incorrectly-OO is not enabled, and any docstings would have a surrogate, UnicodeDecodeError (subclass of ValueError) is raisedIt seems like the error conditions are a bit complicated and may change from version to version, so maybe it's good to keep it a bit opaque? Meaning: if you want to use this function and you expect the input to sometimes be invalid, prepare to catch both SyntaxError and ValueError
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1b5431a to
eeb1ceb
Compare
There was an error while loading. Please reload this page.
|
Thanks @decorator-factory for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @decorator-factory and @hugovk, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @decorator-factory and @hugovk, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@decorator-factory Would you like to have a go at backporting? See instructions above. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@hugovk Yes, I'll try to do that. Backports are just pull requests to branches other than main, correct? And in this case, miss Islington failed to generate a PR due to conflicts, and now I just need to make those PRs to 3.13 and 3.14 branches? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ring adjustments in 3.13 (pythonGH-142413) (cherry picked from commit f6b6a99) Co-authored-by: decorator-factory <[email protected]>
|
GH-142689 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-142690 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Exactly so. Thanks, merged! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.