bpo-37050: Remove expr_text from FormattedValue ast node, use Constant node instead (GH-13597)

When using the "=" debug functionality of f-strings, use another Constant node (or a merged constant node) instead of adding expr_text to the FormattedValue node.
This commit is contained in:
Eric V. Smith 2019-05-27 15:31:52 -04:00 committed by GitHub
parent 695b1dd8cb
commit 6f6ff8a565
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 100 deletions

View file

@ -3963,12 +3963,6 @@ compiler_formatted_value(struct compiler *c, expr_ty e)
int conversion = e->v.FormattedValue.conversion;
int oparg;
if (e->v.FormattedValue.expr_text) {
/* Push the text of the expression (which already has the '=' in
it. */
ADDOP_LOAD_CONST(c, e->v.FormattedValue.expr_text);
}
/* The expression to be formatted. */
VISIT(c, expr, e->v.FormattedValue.value);
@ -3991,11 +3985,6 @@ compiler_formatted_value(struct compiler *c, expr_ty e)
/* And push our opcode and oparg */
ADDOP_I(c, FORMAT_VALUE, oparg);
/* If we have expr_text, join the 2 strings on the stack. */
if (e->v.FormattedValue.expr_text) {
ADDOP_I(c, BUILD_STRING, 2);
}
return 1;
}