ast.arg needs lineno and col_offset in 3.5.1

This commit is contained in:
adam j hartz 2015-12-11 17:39:08 -05:00
parent 58e589d8da
commit f8334a76b7

View file

@ -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