Hello community, here is the log from the commit of package python-gast for openSUSE:Factory checked in at 2020-08-29 20:34:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-gast (Old) and /work/SRC/openSUSE:Factory/.python-gast.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-gast" Sat Aug 29 20:34:21 2020 rev:4 rq:829660 version:0.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-gast/python-gast.changes 2020-04-07 10:32:05.210558420 +0200 +++ /work/SRC/openSUSE:Factory/.python-gast.new.3399/python-gast.changes 2020-08-29 20:34:43.433272691 +0200 @@ -1,0 +2,6 @@ +Wed Aug 26 06:01:54 UTC 2020 - Steve Kowalik <[email protected]> + +- Update to 0.4.0: + * Support Python 3.9 + +------------------------------------------------------------------- Old: ---- gast-0.3.3.tar.gz New: ---- gast-0.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-gast.spec ++++++ --- /var/tmp/diff_new_pack.6H18xG/_old 2020-08-29 20:34:45.189273431 +0200 +++ /var/tmp/diff_new_pack.6H18xG/_new 2020-08-29 20:34:45.189273431 +0200 @@ -19,11 +19,10 @@ %define srcname gast %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-gast -Version: 0.3.3 +Version: 0.4.0 Release: 0 Summary: Python AST that abstracts the underlying Python version License: BSD-3-Clause -Group: Development/Languages/Python URL: https://github.com/serge-sans-paille/gast/ Source: https://github.com/serge-sans-paille/gast/archive/%{version}.tar.gz#/%{srcname}-%{version}.tar.gz BuildRequires: %{python_module setuptools} ++++++ gast-0.3.3.tar.gz -> gast-0.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/.travis.yml new/gast-0.4.0/.travis.yml --- old/gast-0.3.3/.travis.yml 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/.travis.yml 2020-07-21 17:20:16.000000000 +0200 @@ -8,5 +8,6 @@ - "3.6" - "3.7" - "3.8" + - "3.9-dev" install: pip install tox-travis script: tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/README.rst new/gast-0.4.0/README.rst --- old/gast-0.3.3/README.rst 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/README.rst 2020-07-21 17:20:16.000000000 +0200 @@ -57,10 +57,13 @@ Python3 ******* -The AST used by GAST is the same as the one used in Python3.8, with the +The AST used by GAST is the same as the one used in Python3.9, with the notable exception of ``ast.arg`` being replaced by an ``ast.Name`` with an ``ast.Param`` context. +For minor version before 3.9, please note that ``ExtSlice`` and ``Index`` are +not used. + For minor version before 3.8, please note that ``Ellipsis``, ``Num``, ``Str``, ``Bytes`` and ``NamedConstant`` are represented as ``Constant``. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/gast/ast2.py new/gast-0.4.0/gast/ast2.py --- old/gast-0.3.3/gast/ast2.py 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/gast/ast2.py 2020-07-21 17:20:16.000000000 +0200 @@ -142,9 +142,6 @@ def visit_Subscript(self, node): new_slice = self._visit(node.slice) - if isinstance(node.slice, ast.Ellipsis): - new_slice = gast.Index(new_slice) - new_node = gast.Subscript( self._visit(node.value), new_slice, @@ -163,17 +160,12 @@ new_node.end_lineno = new_node.end_col_offset = None return new_node + def visit_Index(self, node): + return self._visit(node.value) + def visit_ExtSlice(self, node): - has_ellipsis = any(isinstance(d, ast.Ellipsis) for d in node.dims) - has_slice = any(isinstance(d, ast.Slice) for d in node.dims) new_dims = self._visit(node.dims) - if has_ellipsis and not has_slice: - new_dims = [nd.value if isinstance(nd, gast.Index) else nd - for nd in new_dims] - new_node = gast.Index(gast.Tuple(new_dims, - gast.Load())) - else: - new_node = gast.ExtSlice(new_dims) + new_node = gast.Tuple(new_dims, gast.Load()) gast.copy_location(new_node, node) new_node.end_lineno = new_node.end_col_offset = None return new_node @@ -354,21 +346,26 @@ ast.copy_location(new_node, node) return new_node - def visit_Index(self, node): - new_value = self._visit(node.value) - if isinstance(new_value, ast.Ellipsis): - new_node = new_value - elif isinstance(new_value, ast.Tuple): - if any(isinstance(elt, ast.Ellipsis) for elt in new_value.elts): - new_elts = [elt if isinstance(elt, (ast.Ellipsis, ast.Slice)) - else ast.Index(elt) - for elt in new_value.elts] - new_node = ast.ExtSlice(new_elts) + def visit_Subscript(self, node): + def adjust_slice(s): + if isinstance(s, (ast.Slice, ast.Ellipsis)): + return s else: - new_node = ast.Index(new_value) + return ast.Index(s) + if isinstance(node.slice, gast.Tuple): + new_slice = ast.ExtSlice([adjust_slice(self._visit(elt)) + for elt in node.slice.elts]) else: - new_node = ast.Index(new_value) + new_slice = adjust_slice(self._visit(node.slice)) + ast.copy_location(new_slice, node.slice) + + new_node = ast.Subscript( + self._visit(node.value), + new_slice, + self._visit(node.ctx), + ) ast.copy_location(new_node, node) + new_node.end_lineno = new_node.end_col_offset = None return new_node def visit_Call(self, node): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/gast/ast3.py new/gast-0.4.0/gast/ast3.py --- old/gast-0.3.3/gast/ast3.py 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/gast/ast3.py 2020-07-21 17:20:16.000000000 +0200 @@ -5,6 +5,15 @@ class Ast3ToGAst(AstToGAst): + if sys.version_info.minor < 9: + + def visit_ExtSlice(self, node): + new_node = gast.Tuple(self._visit(node.dims), gast.Load()) + gast.copy_location(new_node, node) + return new_node + + def visit_Index(self, node): + return self._visit(node.value) if sys.version_info.minor < 8: def visit_Module(self, node): @@ -122,7 +131,9 @@ starred = [] if node.kwargs: - kwargs = [gast.keyword(None, self._visit(node.kwargs))] + kw = gast.keyword(None, self._visit(node.kwargs)) + gast.copy_location(kw, node.kwargs) + kwargs = [kw] else: kwargs = [] else: @@ -208,6 +219,33 @@ class GAstToAst3(GAstToAst): + if sys.version_info.minor < 9: + def visit_Subscript(self, node): + def adjust_slice(s): + if isinstance(s, ast.Slice): + return s + else: + return ast.Index(s) + if isinstance(node.slice, gast.Tuple): + if any(isinstance(elt, gast.slice) for elt in node.slice.elts): + new_slice = ast.ExtSlice( + [adjust_slice(x) for x in + self._visit(node.slice.elts)]) + else: + value = ast.Tuple(self._visit(node.slice.elts), ast.Load()) + ast.copy_location(value, node.slice) + new_slice = ast.Index(value) + else: + new_slice = adjust_slice(self._visit(node.slice)) + ast.copy_location(new_slice, node.slice) + + new_node = ast.Subscript( + self._visit(node.value), + new_slice, + self._visit(node.ctx), + ) + ast.copy_location(new_node, node) + return new_node if sys.version_info.minor < 8: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/gast/gast.py new/gast-0.4.0/gast/gast.py --- old/gast-0.3.3/gast/gast.py 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/gast/gast.py 2020-07-21 17:20:16.000000000 +0200 @@ -218,9 +218,9 @@ ('Param', ((), (), (expr_context,))), # slice - ('Slice', (('lower', 'upper', 'step'), (), (slice,))), - ('ExtSlice', (('dims',), (), (slice,))), - ('Index', (('value',), (), (slice,))), + ('Slice', (('lower', 'upper', 'step'), + ('lineno', 'col_offset', 'end_lineno', 'end_col_offset',), + (slice,))), # boolop ('And', ((), (), (boolop,))), @@ -273,7 +273,9 @@ 'kw_defaults', 'kwarg', 'defaults'), (), (AST,))), # keyword - ('keyword', (('arg', 'value'), (), (AST,))), + ('keyword', (('arg', 'value'), + ('lineno', 'col_offset', 'end_lineno', 'end_col_offset'), + (AST,))), # alias ('alias', (('name', 'asname'), (), (AST,))), @@ -374,7 +376,7 @@ """ for child in walk(node): if 'lineno' in child._attributes: - child.lineno = getattr(child, 'lineno', 0) + n + child.lineno = (getattr(child, 'lineno', 0) or 0) + n if 'end_lineno' in child._attributes: - child.end_lineno = getattr(child, 'end_lineno', 0) + n + child.end_lineno = (getattr(child, 'end_lineno', 0) or 0) + n return node diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/setup.py new/gast-0.4.0/setup.py --- old/gast-0.3.3/setup.py 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/setup.py 2020-07-21 17:20:16.000000000 +0200 @@ -10,7 +10,7 @@ kw = {} setup(name='gast', # gast, daou naer! - version='0.3.3', + version='0.4.0', packages=['gast'], description='Python AST that abstracts the underlying Python version', long_description=''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/tests/test_compat.py new/gast-0.4.0/tests/test_compat.py --- old/gast-0.3.3/tests/test_compat.py 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/tests/test_compat.py 2020-07-21 17:20:16.000000000 +0200 @@ -252,12 +252,13 @@ "], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[]" ", kwarg=None, defaults=[]), body=[Expr(value=Subscript(value=" "Name(id='a', ctx=Load(), annotation=None, type_comment=None)" - ", slice=Index(value=Constant(value=1, kind=None)), ctx=Load()" + ", slice=Constant(value=1, kind=None), ctx=Load()" "))], decorator_list=[], returns=None, type_comment=None)]" ", type_ignores=[])") self.assertEqual(gast.dump(tree), norm) def test_ExtSlice(self): + self.maxDiff = None code = 'def foo(a): a[:,:]' tree = gast.parse(code) compile(gast.gast_to_ast(tree), '<test>', 'exec') @@ -266,13 +267,14 @@ "], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[]" ", kwarg=None, defaults=[]), body=[Expr(value=Subscript(value=" "Name(id='a', ctx=Load(), annotation=None, type_comment=None)" - ", slice=ExtSlice(dims=[Slice(lower=None, upper=None, step=" - "None), Slice(lower=None, upper=None, step=None)]), ctx=Load()" - "))], decorator_list=[], returns=None, type_comment=None)], " - "type_ignores=[])") + ", slice=Tuple(elts=[Slice(lower=None, upper=None, step=" + "None), Slice(lower=None, upper=None, step=None)], ctx=Load())" + ", ctx=Load()))], decorator_list=[], returns=None, " + "type_comment=None)], type_ignores=[])") self.assertEqual(gast.dump(tree), norm) def test_ExtSlices(self): + self.maxDiff = None code = 'def foo(a): a[1,:]' tree = gast.parse(code) compile(gast.gast_to_ast(tree), '<test>', 'exec') @@ -281,10 +283,10 @@ "], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[]" ", kwarg=None, defaults=[]), body=[Expr(value=Subscript(value=" "Name(id='a', ctx=Load(), annotation=None, type_comment=None)" - ", slice=ExtSlice(dims=[Index(value=Constant(value=1, kind=" - "None)), Slice(lower=None, upper=None, step=None)]), ctx=Load" - "()))], decorator_list=[], returns=None, type_comment=None)]" - ", type_ignores=[])") + ", slice=Tuple(elts=[Constant(value=1, kind=" + "None), Slice(lower=None, upper=None, step=None)], ctx=Load())" + ", ctx=Load()))], decorator_list=[], returns=None, " + "type_comment=None)], type_ignores=[])") self.assertEqual(gast.dump(tree), norm) def test_Ellipsis(self): @@ -297,8 +299,8 @@ "], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[]" ", kwarg=None, defaults=[]), body=[Expr(value=Subscript(value=" "Name(id='a', ctx=Load(), annotation=None, type_comment=None)" - ", slice=Index(value=Constant(value=Ellipsis, kind=None)), ctx" - "=Load()))], decorator_list=[], returns=None, type_comment=" + ", slice=Constant(value=Ellipsis, kind=None), ctx=Load()))], " + "decorator_list=[], returns=None, type_comment=" "None)], type_ignores=[])") self.assertEqual(gast.dump(tree), norm) @@ -312,8 +314,8 @@ "], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[]" ", kwarg=None, defaults=[]), body=[Expr(value=Subscript(value=" "Name(id='a', ctx=Load(), annotation=None, type_comment=None)" - ", slice=Index(value=Tuple(elts=[Constant(value=1, kind=None)" - ", Constant(value=Ellipsis, kind=None)], ctx=Load())), ctx=" + ", slice=Tuple(elts=[Constant(value=1, kind=None)" + ", Constant(value=Ellipsis, kind=None)], ctx=Load()), ctx=" "Load()))], decorator_list=[], returns=None, type_comment=" "None)], type_ignores=[])") self.assertEqual(gast.dump(tree), norm) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.3.3/tox.ini new/gast-0.4.0/tox.ini --- old/gast-0.3.3/tox.ini 2020-01-19 21:10:35.000000000 +0100 +++ new/gast-0.4.0/tox.ini 2020-07-21 17:20:16.000000000 +0200 @@ -1,5 +1,5 @@ [tox] -envlist = py27,py34,py35,py36,py37,py38 +envlist = py27,py34,py35,py36,py37,py38,py39 [testenv] deps = astunparse
