mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Fix DeprecationWarning while initializing Expression
(#5739)
* Fix DeprecationWarning while initializing `Expression` * Add news item * Rename the news file to the branch name * Fixing more ast related warnings
This commit is contained in:
parent
599f1c0f36
commit
0791372f30
2 changed files with 32 additions and 4 deletions
23
news/fix_warning_Expression.rst
Normal file
23
news/fix_warning_Expression.rst
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
**Added:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Changed:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Deprecated:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Removed:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Fixed:**
|
||||||
|
|
||||||
|
* Fix DeprecationWarning while initializing Expression
|
||||||
|
|
||||||
|
**Security:**
|
||||||
|
|
||||||
|
* <news item>
|
|
@ -738,7 +738,9 @@ class BaseParser:
|
||||||
def p_eval_input(self, p):
|
def p_eval_input(self, p):
|
||||||
"""eval_input : testlist newlines_opt"""
|
"""eval_input : testlist newlines_opt"""
|
||||||
p1 = p[1]
|
p1 = p[1]
|
||||||
p[0] = ast.Expression(body=p1, lineno=p1.lineno, col_offset=p1.col_offset)
|
p[0] = ast.Expression(body=p1)
|
||||||
|
p[0].lineno = p1.lineno
|
||||||
|
p[0].col_offset = p1.col_offset
|
||||||
|
|
||||||
def p_func_call(self, p):
|
def p_func_call(self, p):
|
||||||
"""func_call : LPAREN arglist_opt RPAREN"""
|
"""func_call : LPAREN arglist_opt RPAREN"""
|
||||||
|
@ -2155,7 +2157,8 @@ class BaseParser:
|
||||||
| minus_tok term
|
| minus_tok term
|
||||||
"""
|
"""
|
||||||
p1 = p[1]
|
p1 = p[1]
|
||||||
op = self._term_binops[p1.value](lineno=p1.lineno, col_offset=p1.lexpos)
|
op = self._term_binops[p1.value]()
|
||||||
|
op.lineno, op.col_offset = p1.lineno, p1.lexpos
|
||||||
p[0] = [op, p[2]]
|
p[0] = [op, p[2]]
|
||||||
|
|
||||||
def p_term(self, p):
|
def p_term(self, p):
|
||||||
|
@ -2194,7 +2197,9 @@ class BaseParser:
|
||||||
f"operation {p1!r} not supported",
|
f"operation {p1!r} not supported",
|
||||||
self.currloc(lineno=p.lineno, column=p.lexpos),
|
self.currloc(lineno=p.lineno, column=p.lexpos),
|
||||||
)
|
)
|
||||||
p[0] = [op(lineno=p1.lineno, col_offset=p1.lexpos), p[2]]
|
op_node = op()
|
||||||
|
op_node.lineno, op_node.col_offset = p1.lineno, p1.lexpos
|
||||||
|
p[0] = [op_node, p[2]]
|
||||||
|
|
||||||
_factor_ops = {"+": ast.UAdd, "-": ast.USub, "~": ast.Invert}
|
_factor_ops = {"+": ast.UAdd, "-": ast.USub, "~": ast.Invert}
|
||||||
|
|
||||||
|
@ -3047,7 +3052,7 @@ class BaseParser:
|
||||||
else:
|
else:
|
||||||
targ = ensure_has_elts(targs)
|
targ = ensure_has_elts(targs)
|
||||||
store_ctx(targ)
|
store_ctx(targ)
|
||||||
comp = ast.comprehension(target=targ, iter=it, ifs=[])
|
comp = ast.comprehension(target=targ, iter=it, ifs=[], is_async=0)
|
||||||
comps = [comp]
|
comps = [comp]
|
||||||
p0 = {"comps": comps}
|
p0 = {"comps": comps}
|
||||||
if p5 is not None:
|
if p5 is not None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue