Skip to content

bpo-31464: asdl_c.py no longer emits trailing spaces in Python-ast.h. #3568

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

Merged
merged 1 commit into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 59 additions & 59 deletions Include/Python-ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ struct _mod {
asdl_seq *body;
string docstring;
} Module;

struct {
asdl_seq *body;
} Interactive;

struct {
expr_ty body;
} Expression;

struct {
asdl_seq *body;
} Suite;

} v;
};

Expand All @@ -83,7 +83,7 @@ struct _stmt {
expr_ty returns;
string docstring;
} FunctionDef;

struct {
identifier name;
arguments_ty args;
Expand All @@ -92,7 +92,7 @@ struct _stmt {
expr_ty returns;
string docstring;
} AsyncFunctionDef;

struct {
identifier name;
asdl_seq *bases;
Expand All @@ -101,108 +101,108 @@ struct _stmt {
asdl_seq *decorator_list;
string docstring;
} ClassDef;

struct {
expr_ty value;
} Return;

struct {
asdl_seq *targets;
} Delete;

struct {
asdl_seq *targets;
expr_ty value;
} Assign;

struct {
expr_ty target;
operator_ty op;
expr_ty value;
} AugAssign;

struct {
expr_ty target;
expr_ty annotation;
expr_ty value;
int simple;
} AnnAssign;

struct {
expr_ty target;
expr_ty iter;
asdl_seq *body;
asdl_seq *orelse;
} For;

struct {
expr_ty target;
expr_ty iter;
asdl_seq *body;
asdl_seq *orelse;
} AsyncFor;

struct {
expr_ty test;
asdl_seq *body;
asdl_seq *orelse;
} While;

struct {
expr_ty test;
asdl_seq *body;
asdl_seq *orelse;
} If;

struct {
asdl_seq *items;
asdl_seq *body;
} With;

struct {
asdl_seq *items;
asdl_seq *body;
} AsyncWith;

struct {
expr_ty exc;
expr_ty cause;
} Raise;

struct {
asdl_seq *body;
asdl_seq *handlers;
asdl_seq *orelse;
asdl_seq *finalbody;
} Try;

struct {
expr_ty test;
expr_ty msg;
} Assert;

struct {
asdl_seq *names;
} Import;

struct {
identifier module;
asdl_seq *names;
int level;
} ImportFrom;

struct {
asdl_seq *names;
} Global;

struct {
asdl_seq *names;
} Nonlocal;

struct {
expr_ty value;
} Expr;

} v;
int lineno;
int col_offset;
Expand All @@ -224,145 +224,145 @@ struct _expr {
boolop_ty op;
asdl_seq *values;
} BoolOp;

struct {
expr_ty left;
operator_ty op;
expr_ty right;
} BinOp;

struct {
unaryop_ty op;
expr_ty operand;
} UnaryOp;

struct {
arguments_ty args;
expr_ty body;
} Lambda;

struct {
expr_ty test;
expr_ty body;
expr_ty orelse;
} IfExp;

struct {
asdl_seq *keys;
asdl_seq *values;
} Dict;

struct {
asdl_seq *elts;
} Set;

struct {
expr_ty elt;
asdl_seq *generators;
} ListComp;

struct {
expr_ty elt;
asdl_seq *generators;
} SetComp;

struct {
expr_ty key;
expr_ty value;
asdl_seq *generators;
} DictComp;

struct {
expr_ty elt;
asdl_seq *generators;
} GeneratorExp;

struct {
expr_ty value;
} Await;

struct {
expr_ty value;
} Yield;

struct {
expr_ty value;
} YieldFrom;

struct {
expr_ty left;
asdl_int_seq *ops;
asdl_seq *comparators;
} Compare;

struct {
expr_ty func;
asdl_seq *args;
asdl_seq *keywords;
} Call;

struct {
object n;
} Num;

struct {
string s;
} Str;

struct {
expr_ty value;
int conversion;
expr_ty format_spec;
} FormattedValue;

struct {
asdl_seq *values;
} JoinedStr;

struct {
bytes s;
} Bytes;

struct {
singleton value;
} NameConstant;

struct {
constant value;
} Constant;

struct {
expr_ty value;
identifier attr;
expr_context_ty ctx;
} Attribute;

struct {
expr_ty value;
slice_ty slice;
expr_context_ty ctx;
} Subscript;

struct {
expr_ty value;
expr_context_ty ctx;
} Starred;

struct {
identifier id;
expr_context_ty ctx;
} Name;

struct {
asdl_seq *elts;
expr_context_ty ctx;
} List;

struct {
asdl_seq *elts;
expr_context_ty ctx;
} Tuple;

} v;
int lineno;
int col_offset;
Expand All @@ -377,15 +377,15 @@ struct _slice {
expr_ty upper;
expr_ty step;
} Slice;

struct {
asdl_seq *dims;
} ExtSlice;

struct {
expr_ty value;
} Index;

} v;
};

Expand All @@ -405,7 +405,7 @@ struct _excepthandler {
identifier name;
asdl_seq *body;
} ExceptHandler;

} v;
int lineno;
int col_offset;
Expand Down
5 changes: 3 additions & 2 deletions Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ def emit(self, s, depth, reflow=True):
else:
lines = [s]
for line in lines:
line = (" " * TABSIZE * depth) + line + "\n"
self.file.write(line)
if line:
line = (" " * TABSIZE * depth) + line
self.file.write(line + "\n")


class TypeDefVisitor(EmitVisitor):
Expand Down