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 — bpo-32911: Remove the docstring attribute of AST types by serhiy-storchaka · Pull Request #7121 · python/cpython Conversation
| ||||||||||||||||||||||||||||||||||||
|
When you're done making the requested changes, leave the comment: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Note that while the previous 3.7.0a1 NEWS entry is modified by the current patch, there'll need to be a dedicated NEWS entry for the reversion that will then appear under 3.7.0b5. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return 1; | ||
| } | ||
| int docstring = isdocstring((stmt_ty)asdl_seq_GET(stmts, 0)); | ||
| CALL_SEQ(astfold_stmt, stmt_ty, stmts); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Loop from 1 seems simpler than JoinedStr hack.
for (int i = docstring; i < asdl_seq_LEN(stmts); i++) { stmt_ty st = (stmt_ty)asdl_seq_GET(stmts, i); if (st != NULL && !astfold_stmt(st, ctx_, optimize_)) { return 0; } }
Sorry, something went wrong.
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.
A JoinedStr hack is needed for preventing interpreting a new constant string created by optimization as a docstring:
def foo(): 'Not a' + ' docstring' pass
but we still want to apply optimizations to the first statement.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, I don't know Git well still, and loss a news entry when applied Inada's patch. I didn't think that a magic number bumping is needed, because this PR affects AST. But it also affects the first line number of nodes with docstrings. I'll bump a magic number. |
Sorry, something went wrong.
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.
A couple of wording improvements
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,4 @@ | |||
| Reverted :issue:`29463`. ``docstring`` field is removed from Module, ClassDef, | |||
| FunctionDef, and AsyncFunctionDef ast nodes which is added in 3.7a1. Docstring | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
"which was added"
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,4 @@ | |||
| Reverted :issue:`29463`. ``docstring`` field is removed from Module, ClassDef, | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We should say why we are doing this. Perhaps start the entry with:
"Due to unexpected compatibility issues discovered during downstream beta testing, reverted ... "
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
When you're done making the requested changes, leave the comment: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @methane, @ned-deily, @ncoghlan: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Remove the docstring attribute of AST types and restore docstring expression as a first stmt in their body. Co-authored-by: INADA Naoki <[email protected]>
|
Thanks @serhiy-storchaka! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Earlier development versions of Python 3.7 added the docstring field to AST nodes. This was later reverted in Python 3.7.0b5. https://bugs.python.org/issue29463 python/cpython#7121
Earlier development versions of Python 3.7 added the docstring field to AST nodes. This was later reverted in Python 3.7.0b5. https://bugs.python.org/issue29463 python/cpython#7121
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.