Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-asteval for openSUSE:Factory checked in at 2022-12-02 15:47:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-asteval (Old) and /work/SRC/openSUSE:Factory/.python-asteval.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-asteval" Fri Dec 2 15:47:26 2022 rev:13 rq:1039546 version:0.9.28 Changes: -------- --- /work/SRC/openSUSE:Factory/python-asteval/python-asteval.changes 2022-09-07 11:06:53.760537589 +0200 +++ /work/SRC/openSUSE:Factory/.python-asteval.new.1835/python-asteval.changes 2022-12-02 15:47:28.736586910 +0100 @@ -1,0 +2,9 @@ +Thu Dec 1 22:16:19 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to 0.9.28 + * add support for Python 3.11 + * add support for multiple list comprehensions + * improve performance of making the initial symbol table, + and Interpreter creation, including better checking for index_tricks attributes + +------------------------------------------------------------------- Old: ---- asteval-0.9.27.tar.gz New: ---- asteval-0.9.28.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-asteval.spec ++++++ --- /var/tmp/diff_new_pack.gBgtv0/_old 2022-12-02 15:47:29.340590294 +0100 +++ /var/tmp/diff_new_pack.gBgtv0/_new 2022-12-02 15:47:29.348590339 +0100 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-asteval -Version: 0.9.27 +Version: 0.9.28 Release: 0 Summary: Safe, minimalistic evaluator of python expression using ast module License: MIT ++++++ asteval-0.9.27.tar.gz -> asteval-0.9.28.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/.github/workflows/macos_numpy.yml new/asteval-0.9.28/.github/workflows/macos_numpy.yml --- old/asteval-0.9.27/.github/workflows/macos_numpy.yml 2022-02-06 01:57:54.000000000 +0100 +++ new/asteval-0.9.28/.github/workflows/macos_numpy.yml 2022-11-06 17:17:20.000000000 +0100 @@ -8,7 +8,7 @@ strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/.github/workflows/ubuntu_nonumpy.yml new/asteval-0.9.28/.github/workflows/ubuntu_nonumpy.yml --- old/asteval-0.9.27/.github/workflows/ubuntu_nonumpy.yml 2022-02-06 01:58:49.000000000 +0100 +++ new/asteval-0.9.28/.github/workflows/ubuntu_nonumpy.yml 2022-11-06 17:17:56.000000000 +0100 @@ -13,7 +13,7 @@ strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/.github/workflows/ubuntu_numpy.yml new/asteval-0.9.28/.github/workflows/ubuntu_numpy.yml --- old/asteval-0.9.27/.github/workflows/ubuntu_numpy.yml 2022-02-06 07:53:26.000000000 +0100 +++ new/asteval-0.9.28/.github/workflows/ubuntu_numpy.yml 2022-11-06 17:17:46.000000000 +0100 @@ -13,7 +13,7 @@ strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/.github/workflows/windows_numpy.yml new/asteval-0.9.28/.github/workflows/windows_numpy.yml --- old/asteval-0.9.27/.github/workflows/windows_numpy.yml 2022-02-06 01:58:09.000000000 +0100 +++ new/asteval-0.9.28/.github/workflows/windows_numpy.yml 2022-11-06 17:18:04.000000000 +0100 @@ -8,7 +8,7 @@ strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/PKG-INFO new/asteval-0.9.28/PKG-INFO --- old/asteval-0.9.27/PKG-INFO 2022-05-24 17:45:15.285941400 +0200 +++ new/asteval-0.9.28/PKG-INFO 2022-11-07 22:53:36.137773000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: asteval -Version: 0.9.27 +Version: 0.9.28 Summary: Safe, minimalistic evaluator of python expression using ast module Home-page: https://github.com/newville/asteval Author: Matthew Newville diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/asteval/asteval.py new/asteval-0.9.28/asteval/asteval.py --- old/asteval-0.9.27/asteval/asteval.py 2022-05-24 13:40:00.000000000 +0200 +++ new/asteval-0.9.28/asteval/asteval.py 2022-11-06 21:40:29.000000000 +0100 @@ -37,6 +37,7 @@ 'getattr' for example) """ import ast +import copy import inspect import time from sys import exc_info, stderr, stdout @@ -185,7 +186,7 @@ self.no_deepcopy = [key for key, val in symtable.items() if (callable(val) or inspect.ismodule(val) - or 'numpy.lib.index_tricks' in repr(val))] + or 'numpy.lib.index_tricks' in repr(type(val)))] def remove_nodehandler(self, node): """remove support for a node @@ -238,7 +239,7 @@ self._interrupt = ast.Raise() self.error.append(err) if self.error_msg is None: - self.error_msg = "at expr='%s'" % (self.expr) + self.error_msg = (' '.join([msg, "at expr='%s'" % (self.expr)])).strip() elif len(msg) > 0: self.error_msg = msg if exc is None: @@ -675,19 +676,80 @@ self._interrupt = None def on_listcomp(self, node): # ('elt', 'generators') - """List comprehension.""" + """List comprehension -- only up to 4 generators!""" out = [] + locals = {} + saved_syms = {} + + for tnode in node.generators: + if tnode.__class__ == ast.comprehension: + if tnode.target.__class__ == ast.Name: + if (not valid_symbol_name(tnode.target.id) or + tnode.target.id in self.readonly_symbols): + errmsg = "invalid symbol name (reserved word?) %s" % tnode.target.id + self.raise_exception(tnode.target, exc=NameError, msg=errmsg) + locals[tnode.target.id] = [] + if tnode.target.id in self.symtable: + saved_syms[tnode.target.id] = copy.deepcopy(self.symtable[tnode.target.id]) + + elif tnode.target.__class__ == ast.Tuple: + target = [] + for tval in tnode.target.elts: + locals[tval.id] = [] + if tval.id in self.symtable: + saved_syms[tval.id] = copy.deepcopy(self.symtable[tval.id]) + for tnode in node.generators: if tnode.__class__ == ast.comprehension: + tlist = [] + ttype = 'name' + if tnode.target.__class__ == ast.Name: + if (not valid_symbol_name(tnode.target.id) or + tnode.target.id in self.readonly_symbols): + errmsg = "invalid symbol name (reserved word?) %s" % tnode.target.id + self.raise_exception(tnode.target, exc=NameError, msg=errmsg) + ttype, target = 'name', tnode.target.id + elif tnode.target.__class__ == ast.Tuple: + ttype = 'tuple' + target =tuple([tval.id for tval in tnode.target.elts]) + for val in self.run(tnode.iter): - self.node_assign(tnode.target, val) + if ttype == 'name': + self.symtable[target] = val + else: + for telem, tval in zip(target, val): + self.symtable[target] = val + add = True for cond in tnode.ifs: add = add and self.run(cond) if add: - out.append(self.run(node.elt)) + if ttype == 'name': + locals[target].append(val) + else: + for telem, tval in zip(target, val): + locals[telem].append(tval) + + def listcomp_recurse(i, names, data): + if i == len(names): + out.append(self.run(node.elt)) + return + + for val in data[i]: + self.symtable[names[i]] = val + listcomp_recurse(i+1, names, data) + + names = list(locals.keys()) + data = list(locals.values()) + + listcomp_recurse(0, names, data) + + for name, val in saved_syms.items(): + self.symtable[name] = val + return out + def on_excepthandler(self, node): # ('type', 'name', 'body') """Exception handler...""" return (self.run(node.type), node.name, node.body) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/asteval/astutils.py new/asteval-0.9.28/asteval/astutils.py --- old/asteval-0.9.27/asteval/astutils.py 2022-05-24 13:40:00.000000000 +0200 +++ new/asteval-0.9.28/asteval/astutils.py 2022-09-01 17:44:55.000000000 +0200 @@ -14,6 +14,10 @@ from tokenize import NAME as tk_NAME from tokenize import tokenize as generate_tokens +builtins = __builtins__ +if not isinstance(builtins, dict): + builtins = builtins.__dict__ + HAS_NUMPY = False numpy = None ndarr = None @@ -71,6 +75,8 @@ 'reversed', 'round', 'set', 'slice', 'sorted', 'str', 'sum', 'tuple', 'zip') +BUILTINS_TABLE = {sym: builtins[sym] for sym in FROM_PY if sym in builtins} + # inherit these from python's math FROM_MATH = ('acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'exp', @@ -79,6 +85,9 @@ 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc') +MATH_TABLE = {sym: getattr(math, sym) for sym in FROM_MATH if hasattr(math, sym)} + + FROM_NUMPY = ('Inf', 'NAN', 'abs', 'add', 'alen', 'all', 'amax', 'amin', 'angle', 'any', 'append', 'arange', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', @@ -156,11 +165,31 @@ 'vstack', 'where', 'who', 'zeros', 'zeros_like', 'fft', 'linalg', 'polynomial', 'random') - NUMPY_RENAMES = {'ln': 'log', 'asin': 'arcsin', 'acos': 'arccos', 'atan': 'arctan', 'atan2': 'arctan2', 'atanh': 'arctanh', 'acosh': 'arccosh', 'asinh': 'arcsinh'} +if HAS_NUMPY: + numpy_check = int(numpy_version[0]) == 1 and int(numpy_version[1]) >= 20 + + if numpy_check: + # aliases deprecated in NumPy v1.20.0 + numpy_deprecated = ['str', 'bool', 'int', 'float', 'complex', 'pv', 'rate', + 'pmt', 'ppmt', 'npv', 'nper', 'long', 'mirr', 'fv', + 'irr', 'ipmt'] + FROM_NUMPY = tuple(set(FROM_NUMPY) - set(numpy_deprecated)) + + FROM_NUMPY = tuple(sym for sym in FROM_NUMPY if hasattr(numpy, sym)) + NUMPY_RENAMES = {sym: value for sym, value in NUMPY_RENAMES.items() if hasattr(numpy, sym)} + + NUMPY_TABLE = {} + for sym in FROM_NUMPY: + NUMPY_TABLE[sym] = getattr(numpy, sym) + for name, sym in NUMPY_RENAMES.items(): + NUMPY_TABLE[name] = getattr(numpy, sym) +else: + NUMPY_TABLE = {} + def _open(filename, mode='r', buffering=-1): """read only version of open()""" @@ -217,8 +246,8 @@ if b > MAX_SHIFT: raise RuntimeError(f"Invalid left shift, max left shift is {MAX_SHIFT}") elif HAS_NUMPY and isinstance(b, ndarr): - if numpy.nanmax(b) > MAX_SHIFT: - raise RuntimeError(f"Invalid left shift, max left shift is {MAX_SHIFT}") + if numpy.nanmax(b) > MAX_SHIFT: + raise RuntimeError(f"Invalid left shift, max left shift is {MAX_SHIFT}") return a << b @@ -352,11 +381,6 @@ ast.NodeVisitor.generic_visit(self, node) -builtins = __builtins__ -if not isinstance(builtins, dict): - builtins = builtins.__dict__ - - def get_ast_names(astnode): """Return symbol Names from an AST node.""" finder = NameFinder() @@ -382,30 +406,10 @@ """ symtable = {} - for sym in FROM_PY: - if sym in builtins: - symtable[sym] = builtins[sym] - - for sym in FROM_MATH: - if hasattr(math, sym): - symtable[sym] = getattr(math, sym) - - if HAS_NUMPY and use_numpy: - # aliases deprecated in NumPy v1.20.0 - deprecated = ['str', 'bool', 'int', 'float', 'complex', 'pv', 'rate', - 'pmt', 'ppmt', 'npv', 'nper', 'long', 'mirr', 'fv', - 'irr', 'ipmt'] - numpy_check = int(numpy_version[0]) == 1 and int(numpy_version[1]) >= 20 - - for sym in FROM_NUMPY: - if (numpy_check and sym in deprecated): - continue - if hasattr(numpy, sym): - symtable[sym] = getattr(numpy, sym) - for name, sym in NUMPY_RENAMES.items(): - if hasattr(numpy, sym): - symtable[name] = getattr(numpy, sym) - + symtable.update(BUILTINS_TABLE) + symtable.update(MATH_TABLE) + if use_numpy: + symtable.update(NUMPY_TABLE) symtable.update(LOCALFUNCS) symtable.update(kws) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/asteval/version.py new/asteval-0.9.28/asteval/version.py --- old/asteval-0.9.27/asteval/version.py 2022-05-24 17:45:14.000000000 +0200 +++ new/asteval-0.9.28/asteval/version.py 2022-11-07 22:53:36.000000000 +0100 @@ -1,5 +1,5 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '0.9.27' -version_tuple = (0, 9, 27) +__version__ = version = '0.9.28' +__version_tuple__ = version_tuple = (0, 9, 28) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/asteval.egg-info/PKG-INFO new/asteval-0.9.28/asteval.egg-info/PKG-INFO --- old/asteval-0.9.27/asteval.egg-info/PKG-INFO 2022-05-24 17:45:14.000000000 +0200 +++ new/asteval-0.9.28/asteval.egg-info/PKG-INFO 2022-11-07 22:53:36.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: asteval -Version: 0.9.27 +Version: 0.9.28 Summary: Safe, minimalistic evaluator of python expression using ast module Home-page: https://github.com/newville/asteval Author: Matthew Newville diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/doc/installation.rst new/asteval-0.9.28/doc/installation.rst --- old/asteval-0.9.27/doc/installation.rst 2022-01-16 15:48:47.000000000 +0100 +++ new/asteval-0.9.28/doc/installation.rst 2022-11-06 17:34:40.000000000 +0100 @@ -9,22 +9,23 @@ Requirements ~~~~~~~~~~~~~~~ -Asteval is a pure python module with no required dependencies outside of the -standard library. Asteval will make use of the `numpy`_ module if -available. The test suite requires the `pytest` module. +Asteval is a pure Python module with very few dependencies. For Python 3.8 and +higher, there are no required dependencies outside of the standard +library. Python 3.7 does require the `importlib_metadata` package. If +available, Asteval will make use of the `numpy`_ module. The test suite +requires the `pytest` and `coverage modules, and building the documentation +requires the `sphinx` package. The latest stable version of asteval is |release|. +Versions 0.9.28 and later support and are tested with Python 3.7 through +3.11. There are no immediate plans to drop support Python 3.7. Python versions +have generally been supported until they are past the end-of-maintenance period +for security fixes. Supporting new versions of the Python 3 series is +generally not too much work, but may not be guaranteed until after release of +that version. -Versions 0.9.21 and later support and are tested with Python 3.6 through -3.9. Python 3.6 will be supported until at least its official end of life -(December 2021). No released version supports Python 3.10 yet. - -Versions 0.9.18, 0.9.19, and 0.9.20 supported and were tested with Python -3.5 through 3.8. - -Version 0.9.17 was the last version to support Python 2.7. - +The last version of asteval to support Python 2.7 was version 0.9.17. Download and Installation ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -53,7 +54,7 @@ Installation from source on any platform is:: - python setup.py install + pip install . License ~~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/pyproject.toml new/asteval-0.9.28/pyproject.toml --- old/asteval-0.9.27/pyproject.toml 2022-02-05 23:43:19.000000000 +0100 +++ new/asteval-0.9.28/pyproject.toml 2022-09-01 17:44:51.000000000 +0200 @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] +requires = ["setuptools>=45", "setuptools_scm>=6.2"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.27/tests/test_asteval.py new/asteval-0.9.28/tests/test_asteval.py --- old/asteval-0.9.27/tests/test_asteval.py 2022-01-16 15:48:47.000000000 +0100 +++ new/asteval-0.9.28/tests/test_asteval.py 2022-09-01 18:31:10.000000000 +0200 @@ -597,6 +597,9 @@ self.isvalue('x', [0, 1, 4, 9]) self.interp('x = [i*i for i in range(6) if i > 1]') self.isvalue('x', [4, 9, 16, 25]) + self.interp('x = [(i, j*2) for i in range(6) for j in range(2)]') + self.isvalue('x', [(0, 0), (0, 2), (1, 0), (1, 2), (2, 0), (2, 2), (3, 0), (3, 2), (4, 0), (4, 2), (5, 0), (5, 2)]) + def test_ifexp(self): """test if expressions"""