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-01-23 18:38:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-asteval (Old) and /work/SRC/openSUSE:Factory/.python-asteval.new.1938 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-asteval" Sun Jan 23 18:38:43 2022 rev:11 rq:948243 version:0.9.26 Changes: -------- --- /work/SRC/openSUSE:Factory/python-asteval/python-asteval.changes 2022-01-15 20:05:47.897786996 +0100 +++ /work/SRC/openSUSE:Factory/.python-asteval.new.1938/python-asteval.changes 2022-01-23 18:38:46.349912962 +0100 @@ -1,0 +2,6 @@ +Sun Jan 23 16:38:46 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 0.9.26: + * fix setup.py again + +------------------------------------------------------------------- Old: ---- asteval-0.9.25.tar.gz New: ---- asteval-0.9.26.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-asteval.spec ++++++ --- /var/tmp/diff_new_pack.kcE5Mh/_old 2022-01-23 18:38:46.849909598 +0100 +++ /var/tmp/diff_new_pack.kcE5Mh/_new 2022-01-23 18:38:46.853909572 +0100 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-asteval -Version: 0.9.25 +Version: 0.9.26 Release: 0 Summary: Safe, minimalistic evaluator of python expression using ast module License: MIT ++++++ asteval-0.9.25.tar.gz -> asteval-0.9.26.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/.github/workflows/test-python_pydevel.yml new/asteval-0.9.26/.github/workflows/test-python_pydevel.yml --- old/asteval-0.9.25/.github/workflows/test-python_pydevel.yml 2021-06-22 13:52:13.000000000 +0200 +++ new/asteval-0.9.26/.github/workflows/test-python_pydevel.yml 2021-09-24 18:05:53.000000000 +0200 @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python Development version +name: Python Development version on: push: @@ -16,7 +16,7 @@ strategy: fail-fast: false matrix: - python-version: [3.9, '3.10.0-beta.1'] + python-version: [3.9, '3.10.0-rc.2'] steps: - uses: actions/checkout@v2 @@ -27,12 +27,12 @@ - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install numpy==1.18 pip setuptools codecov pytest pytest-cov coverage + python -m pip install numpy>=1.17 pip setuptools codecov pytest pytest-cov coverage if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | python setup.py install cd tests coverage run --source=asteval -m pytest - coverage report -m + coverage report -m bash <(curl -s https://codecov.io/bash) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/.github/workflows/test_without_numpy.yml new/asteval-0.9.26/.github/workflows/test_without_numpy.yml --- old/asteval-0.9.25/.github/workflows/test_without_numpy.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/asteval-0.9.26/.github/workflows/test_without_numpy.yml 2021-06-22 22:07:05.000000000 +0200 @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Test without numpy + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8, 3.9, '3.10.0-beta.3'] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install setuptools pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + python setup.py install + cd tests + pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/PKG-INFO new/asteval-0.9.26/PKG-INFO --- old/asteval-0.9.25/PKG-INFO 2021-06-22 14:00:29.995816700 +0200 +++ new/asteval-0.9.26/PKG-INFO 2022-01-16 15:45:35.973609200 +0100 @@ -1,21 +1,11 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: asteval -Version: 0.9.25 +Version: 0.9.26 Summary: Safe, minimalistic evaluator of python expression using ast module Home-page: http://github.com/newville/asteval Author: Matthew Newville Author-email: newvi...@cars.uchicago.edu License: OSI Approved :: MIT License -Description: ASTEVAL provides a numpy-aware, safe(ish) 'eval' function - - Emphasis is on mathematical expressions, and so numpy ufuncs - are used if available. Symbols are held in the Interpreter - symbol table 'symtable': a simple dictionary supporting a - simple, flat namespace. - - Expressions can be compiled into ast node for later evaluation, - using the values in the symbol table current at evaluation time. - Platform: UNKNOWN Classifier: Intended Audience :: End Users/Desktop Classifier: Intended Audience :: Developers @@ -23,3 +13,16 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Requires-Python: >=3.6 +License-File: LICENSE + +ASTEVAL provides a numpy-aware, safe(ish) 'eval' function + +Emphasis is on mathematical expressions, and so numpy ufuncs +are used if available. Symbols are held in the Interpreter +symbol table 'symtable': a simple dictionary supporting a +simple, flat namespace. + +Expressions can be compiled into ast node for later evaluation, +using the values in the symbol table current at evaluation time. + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/asteval/asteval.py new/asteval-0.9.26/asteval/asteval.py --- old/asteval-0.9.25/asteval/asteval.py 2021-06-22 03:23:36.000000000 +0200 +++ new/asteval-0.9.26/asteval/asteval.py 2022-01-06 14:18:08.000000000 +0100 @@ -69,6 +69,8 @@ callable file-like object where standard error will be sent. use_numpy : bool whether to use functions from numpy. + max_statement_length : int + maximum length of expression allowed [50,000 characters] minimal : bool create a minimal interpreter: disable all options (see Note 1). no_if : bool @@ -107,8 +109,9 @@ """ def __init__(self, symtable=None, usersyms=None, writer=None, - err_writer=None, use_numpy=True, minimal=False, - no_if=False, no_for=False, no_while=False, no_try=False, + err_writer=None, use_numpy=True, + max_statement_length=50000, minimal=False, no_if=False, + no_for=False, no_while=False, no_try=False, no_functiondef=False, no_ifexp=False, no_listcomp=False, no_augassign=False, no_assert=False, no_delete=False, no_raise=False, no_print=False, max_time=None, @@ -116,6 +119,7 @@ self.writer = writer or stdout self.err_writer = err_writer or stderr + self.max_statement_length = max(1, min(1.e8, max_statement_length)) if symtable is None: if usersyms is None: @@ -128,6 +132,7 @@ self.error_msg = None self.expr = None self.retval = None + self._calldepth = 0 self.lineno = 0 self.start_time = time.time() self.use_numpy = HAS_NUMPY and use_numpy @@ -249,6 +254,10 @@ # eval: string statement -> result = run(parse(statement)) def parse(self, text): """Parse statement/expression to Ast representation.""" + if len(text) > self.max_statement_length: + msg = f'length of text exceeds {self.max_statement_length:d} characters' + self.raise_exception(None, msg='Runtime Error', expr=msg) + self.expr = text try: out = ast.parse(text) @@ -309,21 +318,29 @@ self.lineno = lineno self.error = [] self.start_time = time.time() - try: - node = self.parse(expr) - except: - errmsg = exc_info()[1] - if len(self.error) > 0: - errmsg = "\n".join(self.error[0].get_error()) - if raise_errors: - try: - exc = self.error[0].exc - except: - exc = RuntimeError - raise exc(errmsg) - if show_errors: - print(errmsg, file=self.err_writer) - return + if isinstance(expr, str): + if len(expr) > self.max_statement_length: + msg = f'length of text exceeds {self.max_statement_length:d} characters' + raise ValueError(msg) + + try: + node = self.parse(expr) + except: + errmsg = exc_info()[1] + if len(self.error) > 0: + errmsg = "\n".join(self.error[0].get_error()) + if raise_errors: + try: + exc = self.error[0].exc + except: + exc = RuntimeError + raise exc(errmsg) + if show_errors: + print(errmsg, file=self.err_writer) + return + else: + node = expr + try: return self.run(node, expr=expr, lineno=lineno) except: @@ -356,6 +373,8 @@ def on_return(self, node): # ('value',) """Return statement: look for None, return special sentinel.""" + if self._calldepth == 0: + raise SyntaxError('cannot return at top level') self.retval = self.run(node.value) if self.retval is None: self.retval = ReturnedNone @@ -746,13 +765,20 @@ if kwargs is not None: keywords.update(self.run(kwargs)) + if isinstance(func, Procedure): + self._calldepth += 1 try: - return func(*args, **keywords) + out = func(*args, **keywords) except Exception as ex: + out = None func_name = getattr(func, '__name__', str(func)) self.raise_exception( node, msg="Error running function call '%s' with args %s and " "kwargs %s: %s" % (func_name, args, keywords, ex)) + finally: + if isinstance(func, Procedure): + self._calldepth -= 1 + return out def on_arg(self, node): # ('test', 'msg') """Arg for function definitions.""" @@ -929,6 +955,7 @@ save_symtable = self.__asteval__.symtable.copy() self.__asteval__.symtable.update(symlocals) self.__asteval__.retval = None + self.__asteval__._calldepth += 1 retval = None # evaluate script of function @@ -944,5 +971,6 @@ break self.__asteval__.symtable = save_symtable + self.__asteval__._calldepth -= 1 symlocals = None return retval diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/asteval/astutils.py new/asteval-0.9.26/asteval/astutils.py --- old/asteval-0.9.25/asteval/astutils.py 2021-06-22 03:23:36.000000000 +0200 +++ new/asteval-0.9.26/asteval/astutils.py 2022-01-14 18:58:01.000000000 +0100 @@ -16,6 +16,7 @@ HAS_NUMPY = False numpy = None +ndarr = None try: import numpy ndarr = numpy.ndarray @@ -185,10 +186,14 @@ if isinstance(exp, numbers.Number): if exp > MAX_EXPONENT: raise RuntimeError(f"Invalid exponent, max exponent is {MAX_EXPONENT}") - elif HAS_NUMPY: - if isinstance(exp, numpy.ndarray): - if numpy.nanmax(exp) > MAX_EXPONENT: - raise RuntimeError(f"Invalid exponent, max exponent is {MAX_EXPONENT}") + elif HAS_NUMPY and isinstance(exp, ndarr): + if numpy.nanmax(exp) > MAX_EXPONENT: + raise RuntimeError(f"Invalid exponent, max exponent is {MAX_EXPONENT}") + if isinstance(base, int): + ret = (1.0*base)**exp + if isinstance(exp, int): + return int(ret) + return ret return base ** exp @@ -211,8 +216,7 @@ if isinstance(b, numbers.Number): if b > MAX_SHIFT: raise RuntimeError(f"Invalid left shift, max left shift is {MAX_SHIFT}") - elif HAS_NUMPY: - if isinstance(b, numpy.ndarray): + 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}") return a << b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/asteval.egg-info/PKG-INFO new/asteval-0.9.26/asteval.egg-info/PKG-INFO --- old/asteval-0.9.25/asteval.egg-info/PKG-INFO 2021-06-22 14:00:29.000000000 +0200 +++ new/asteval-0.9.26/asteval.egg-info/PKG-INFO 2022-01-16 15:45:35.000000000 +0100 @@ -1,21 +1,11 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: asteval -Version: 0.9.25 +Version: 0.9.26 Summary: Safe, minimalistic evaluator of python expression using ast module Home-page: http://github.com/newville/asteval Author: Matthew Newville Author-email: newvi...@cars.uchicago.edu License: OSI Approved :: MIT License -Description: ASTEVAL provides a numpy-aware, safe(ish) 'eval' function - - Emphasis is on mathematical expressions, and so numpy ufuncs - are used if available. Symbols are held in the Interpreter - symbol table 'symtable': a simple dictionary supporting a - simple, flat namespace. - - Expressions can be compiled into ast node for later evaluation, - using the values in the symbol table current at evaluation time. - Platform: UNKNOWN Classifier: Intended Audience :: End Users/Desktop Classifier: Intended Audience :: Developers @@ -23,3 +13,16 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Requires-Python: >=3.6 +License-File: LICENSE + +ASTEVAL provides a numpy-aware, safe(ish) 'eval' function + +Emphasis is on mathematical expressions, and so numpy ufuncs +are used if available. Symbols are held in the Interpreter +symbol table 'symtable': a simple dictionary supporting a +simple, flat namespace. + +Expressions can be compiled into ast node for later evaluation, +using the values in the symbol table current at evaluation time. + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/asteval.egg-info/SOURCES.txt new/asteval-0.9.26/asteval.egg-info/SOURCES.txt --- old/asteval-0.9.25/asteval.egg-info/SOURCES.txt 2021-06-22 14:00:29.000000000 +0200 +++ new/asteval-0.9.26/asteval.egg-info/SOURCES.txt 2022-01-16 15:45:35.000000000 +0100 @@ -9,6 +9,7 @@ setup.py .github/workflows/test-python.yml .github/workflows/test-python_pydevel.yml +.github/workflows/test_without_numpy.yml asteval/__init__.py asteval/_version.py asteval/asteval.py @@ -16,6 +17,7 @@ asteval.egg-info/PKG-INFO asteval.egg-info/SOURCES.txt asteval.egg-info/dependency_links.txt +asteval.egg-info/requires.txt asteval.egg-info/top_level.txt doc/Makefile doc/api.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/asteval.egg-info/requires.txt new/asteval-0.9.26/asteval.egg-info/requires.txt --- old/asteval-0.9.25/asteval.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/asteval-0.9.26/asteval.egg-info/requires.txt 2022-01-16 15:45:35.000000000 +0100 @@ -0,0 +1,3 @@ + +[:python_version < "3.8"] +importlib_metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/doc/api.rst new/asteval-0.9.26/doc/api.rst --- old/asteval-0.9.25/doc/api.rst 2021-06-22 03:23:36.000000000 +0200 +++ new/asteval-0.9.26/doc/api.rst 2021-09-25 05:42:48.000000000 +0200 @@ -71,7 +71,7 @@ and the examples elsewhere in this documentation should be used as the stable API. -.. method:: eval(expression[, lineno=0[, show_errors=True]]) +.. method:: eval(expression[, lineno=0[, show_errors=True[, raise_errors=False]]]) evaluate the expression, returning the result. @@ -83,8 +83,11 @@ :param show_errors: whether to print error messages or leave them in the :attr:`errors` list. :type show_errors: bool + :param raise_errors: whether to reraise exceptions or leave them + in the :attr:`errors` list. + :type raise_errors: bool -.. method:: __call__(expression[, lineno=0[, show_errors=True]]) +.. method:: __call__(expression[, lineno=0[, show_errors=True[, raise_errors=False]]]) same as :meth:`eval`. That is:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/requirements.txt new/asteval-0.9.26/requirements.txt --- old/asteval-0.9.25/requirements.txt 2021-06-22 03:23:36.000000000 +0200 +++ new/asteval-0.9.26/requirements.txt 2022-01-16 15:26:33.000000000 +0100 @@ -2,3 +2,4 @@ ## pip requirements file. To install dependencies, use ## ## pip install -r requirements.txt +importlib_metadata ; python_version < '3.8' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/setup.cfg new/asteval-0.9.26/setup.cfg --- old/asteval-0.9.25/setup.cfg 2021-06-22 14:00:29.998718500 +0200 +++ new/asteval-0.9.26/setup.cfg 2022-01-16 15:45:35.981675400 +0100 @@ -1,5 +1,5 @@ [versioneer] -vcs = git +VCS = git style = pep440 versionfile_source = asteval/_version.py versionfile_build = asteval/_version.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/setup.py new/asteval-0.9.26/setup.py --- old/asteval-0.9.25/setup.py 2021-06-22 13:14:48.000000000 +0200 +++ new/asteval-0.9.26/setup.py 2022-01-16 15:30:10.000000000 +0100 @@ -14,6 +14,7 @@ setup(name='asteval', use_scm_version=True, setup_requires=['setuptools_scm'], + install_requires=['importlib_metadata ; python_version < "3.8"'], author='Matthew Newville', author_email='newvi...@cars.uchicago.edu', url='http://github.com/newville/asteval', @@ -21,6 +22,7 @@ python_requires='>=3.6', description="Safe, minimalistic evaluator of python expression using ast module", long_description=long_description, + packages=['asteval'], tests_require=['pytest'], classifiers=['Intended Audience :: End Users/Desktop', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asteval-0.9.25/tests/test_asteval.py new/asteval-0.9.26/tests/test_asteval.py --- old/asteval-0.9.25/tests/test_asteval.py 2021-06-22 03:23:36.000000000 +0200 +++ new/asteval-0.9.26/tests/test_asteval.py 2022-01-03 03:06:47.000000000 +0100 @@ -460,7 +460,8 @@ def test_syntaxerrors_1(self): """assignment syntax errors test""" for expr in ('class = 1', 'for = 1', 'if = 1', 'raise = 1', - '1x = 1', '1.x = 1', '1_x = 1'): + '1x = 1', '1.x = 1', '1_x = 1', + 'return 3', 'return False'): failed = False # noinspection PyBroadException try: @@ -879,10 +880,12 @@ self.check_error('RuntimeError') self.interp("'*'*(2<<17) + '*'") self.check_error('RuntimeError') - self.interp("10**10000") + self.interp("1.01**10000") self.check_error(None) - self.interp("10**10001") + self.interp("1.01**10001") self.check_error('RuntimeError') + self.interp("1.5**10000") + self.check_error('OverflowError') self.interp("1<<1000") self.check_error(None) self.interp("1<<1001")