Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-32911: Add new AST node for docstring#5927

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
methane wants to merge4 commits intopython:masterfrommethane:ast-docstring-node

Conversation

methane
Copy link
Member

@methanemethane commentedFeb 27, 2018
edited by bedevere-bot
Loading

@methane
Copy link
MemberAuthor

Some changes are not PEP 7 compliant because I've copied from old code beforeGH-46.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Added few nitpicks, but LGTM in general!

Python/ast.c Outdated
}
}
returnNULL;
return0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Functions in this file usually return 1 on success and 0 on error (except functions which need to return a non-negative index on success).

c->u->u_lineno = st->lineno;
}
/* Every annotated class and module should have __annotations__. */
if (find_ann(stmts)) {
ADDOP(c, SETUP_ANNOTATIONS);
}
if (!asdl_seq_LEN(stmts))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe move this to the bottom of this function?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should be before asdl_seq_GET.
And this code is copied back from 3.6. (There are extra blank line, I'll remove it)

cpython/Python/compile.c

Lines 1457 to 1459 inbaa4507

if (!asdl_seq_LEN(stmts))
return1;
st= (stmt_ty)asdl_seq_GET(stmts,0);

@@ -81,6 +79,10 @@ def _Expr(self, tree):
self.fill()
self.dispatch(tree.value)

def _DocString(self, t):
self.fill()
self.write(repr(t.s))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why notfill()?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@methane@serhiy-storchaka@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp