mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
ast.arg needs lineno and col_offset in 3.5.1
This commit is contained in:
parent
58e589d8da
commit
f8334a76b7
1 changed files with 11 additions and 3 deletions
|
@ -8,8 +8,9 @@ from ply import yacc
|
|||
|
||||
from xonsh import ast
|
||||
from xonsh.lexer import Lexer
|
||||
from xonsh.tools import VER_3_4, VER_3_5, VER_MAJOR_MINOR, V_MAJOR_MINOR, \
|
||||
docstring_by_version
|
||||
from xonsh.tools import (VER_3_4, VER_3_5, VER_3_5_1,
|
||||
VER_MAJOR_MINOR, VER_FULL,
|
||||
docstring_by_version)
|
||||
|
||||
|
||||
class Location(object):
|
||||
|
@ -582,7 +583,14 @@ class Parser(object):
|
|||
|
||||
def p_tfpdef(self, p):
|
||||
"""tfpdef : NAME colon_test_opt"""
|
||||
p[0] = ast.arg(arg=p[1], annotation=p[2])
|
||||
kwargs = {'arg': p[1],
|
||||
'annotation': p[2]}
|
||||
if VER_FULL >= VER_3_5_1:
|
||||
kwargs.update({
|
||||
'lineno': self.lineno,
|
||||
'col_offset': self.col,
|
||||
})
|
||||
p[0] = ast.arg(**kwargs)
|
||||
|
||||
def p_comma_tfpdef(self, p):
|
||||
"""comma_tfpdef : COMMA
|
||||
|
|
Loading…
Add table
Reference in a new issue