mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
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:
parent
695b1dd8cb
commit
6f6ff8a565
9 changed files with 87 additions and 100 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue