Hello community,

here is the log from the commit of package python-asteval for openSUSE:Factory 
checked in at 2020-01-18 12:17:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-asteval (Old)
 and      /work/SRC/openSUSE:Factory/.python-asteval.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-asteval"

Sat Jan 18 12:17:45 2020 rev:8 rq:765260 version:0.9.18

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-asteval/python-asteval.changes    
2019-12-09 21:38:21.074024245 +0100
+++ /work/SRC/openSUSE:Factory/.python-asteval.new.26092/python-asteval.changes 
2020-01-18 12:18:30.887151253 +0100
@@ -1,0 +2,7 @@
+Fri Jan 17 12:49:59 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 0.9.18
+  * drop python2
+  * few fixes
+
+-------------------------------------------------------------------

Old:
----
  asteval-0.9.17.tar.gz

New:
----
  asteval-0.9.18.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-asteval.spec ++++++
--- /var/tmp/diff_new_pack.CQVsx0/_old  2020-01-18 12:18:31.351151502 +0100
+++ /var/tmp/diff_new_pack.CQVsx0/_new  2020-01-18 12:18:31.351151502 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-asteval
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,14 +16,15 @@
 #
 
 
+%define skip_python2 1
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-asteval
-Version:        0.9.17
+Version:        0.9.18
 Release:        0
 Summary:        Safe, minimalistic evaluator of python expression using ast 
module
 License:        MIT
 Group:          Development/Languages/Python
-URL:            http://github.com/newville/asteval
+URL:            https://github.com/newville/asteval
 Source:         
https://files.pythonhosted.org/packages/source/a/asteval/asteval-%{version}.tar.gz
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
@@ -61,7 +62,7 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} 
py.test-%{$python_bin_suffix} -v
+%pytest
 
 %files %{python_files}
 %doc README.rst

++++++ asteval-0.9.17.tar.gz -> asteval-0.9.18.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/.gitattributes 
new/asteval-0.9.18/.gitattributes
--- old/asteval-0.9.17/.gitattributes   2019-11-14 21:19:47.000000000 +0100
+++ new/asteval-0.9.18/.gitattributes   1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-asteval/_version.py export-subst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/.gitignore 
new/asteval-0.9.18/.gitignore
--- old/asteval-0.9.17/.gitignore       2019-11-14 21:19:47.000000000 +0100
+++ new/asteval-0.9.18/.gitignore       1970-01-01 01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-*.pyc
-*~
-*#
-.coverage
-NonGit/
-doc/_build
-doc/*.pdf
-build
-dist
-*.egg-info
-
-MANIFEST
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/.travis.yml 
new/asteval-0.9.18/.travis.yml
--- old/asteval-0.9.17/.travis.yml      2019-11-14 21:29:09.000000000 +0100
+++ new/asteval-0.9.18/.travis.yml      1970-01-01 01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
-# Config file for automatic testing at travis-ci.org
-
-language: python
-sudo: false
-
-python:
-    - 2.7
-    - 3.5
-    - 3.6
-    - 3.7
-    - 3.8
-
-env:
-    - version=without_numpy
-    - version=with_numpy
-
-before_install:
-    - wget 
https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O 
miniconda.sh
-    - bash miniconda.sh -b -p $HOME/miniconda
-    - export PATH="$HOME/miniconda/bin:$PATH"
-    - hash -r
-    - conda config --set always_yes yes --set changeps1 no
-    - conda update -q conda
-    - conda info -a
-
-install:
-    - conda create -q -n test_env python=$TRAVIS_PYTHON_VERSION pytest coverage
-    - source activate test_env
-    - if [[ $version == with_numpy ]]; then conda install numpy ; fi
-    - python setup.py install
-    - pip install codecov
-
-script:
-    - cd tests
-    - pytest
-    - if [[ $version == with_numpy ]]; then coverage run --source=asteval 
test_asteval.py && coverage report -m ; fi
-
-after_success:
-    - if [[ $version == with_numpy ]]; then codecov ; fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/INSTALL new/asteval-0.9.18/INSTALL
--- old/asteval-0.9.17/INSTALL  2019-11-14 21:19:47.000000000 +0100
+++ new/asteval-0.9.18/INSTALL  2019-12-17 18:36:32.000000000 +0100
@@ -7,10 +7,10 @@
 or 
    pip install asteval
 
-Asteval require Python 2.7 or Python 3.4 or higher.
+Asteval require Python 3.5 or higher.
 If installed, many functions and constants from numpy 
 will be used by default.
 
 Matt Newville <[email protected]>
-Last Update:  28-Oct-2017
+Last Update:  14-Nov-2019
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/PKG-INFO new/asteval-0.9.18/PKG-INFO
--- old/asteval-0.9.17/PKG-INFO 2019-11-14 22:13:24.000000000 +0100
+++ new/asteval-0.9.18/PKG-INFO 2019-12-17 18:36:53.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: asteval
-Version: 0.9.17
+Version: 0.9.18
 Summary: Safe, minimalistic evaluator of python expression using ast module
 Home-page: http://github.com/newville/asteval
 Author: Matthew Newville
@@ -22,4 +22,4 @@
 Classifier: Intended Audience :: Science/Research
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/asteval/__init__.py 
new/asteval-0.9.18/asteval/__init__.py
--- old/asteval-0.9.17/asteval/__init__.py      2019-11-14 21:19:47.000000000 
+0100
+++ new/asteval-0.9.18/asteval/__init__.py      2019-12-17 18:36:32.000000000 
+0100
@@ -18,8 +18,8 @@
 """
 
 from .asteval import Interpreter
-from .astutils import (NameFinder, valid_symbol_name,
-                       make_symbol_table, get_ast_names, check_pyversion)
+from .astutils import (NameFinder, valid_symbol_name, make_symbol_table,
+                       get_ast_names)
 from ._version import get_versions
 
 __all__ = ['Interpreter', 'NameFinder', 'valid_symbol_name',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/asteval/_version.py 
new/asteval-0.9.18/asteval/_version.py
--- old/asteval-0.9.17/asteval/_version.py      2019-11-14 22:13:24.000000000 
+0100
+++ new/asteval-0.9.18/asteval/_version.py      2019-12-17 18:36:53.000000000 
+0100
@@ -8,11 +8,11 @@
 
 version_json = '''
 {
- "date": "2019-11-14T14:59:30-0600",
+ "date": "2019-12-17T11:34:21-0600",
  "dirty": false,
  "error": null,
- "full-revisionid": "e298284ed4778307c6e8145647eddf9bb17f752e",
- "version": "0.9.17"
+ "full-revisionid": "2f796e3560c0e51df52ce8ca8062f2c379452107",
+ "version": "0.9.18"
 }
 '''  # END VERSION_JSON
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/asteval/asteval.py 
new/asteval-0.9.18/asteval/asteval.py
--- old/asteval-0.9.17/asteval/asteval.py       2019-11-14 21:27:44.000000000 
+0100
+++ new/asteval-0.9.18/asteval/asteval.py       2019-12-17 18:36:32.000000000 
+0100
@@ -36,9 +36,6 @@
 functions that are considered unsafe are missing ('eval', 'exec', and
 'getattr' for example)
 """
-
-from __future__ import division, print_function
-
 import ast
 import time
 import inspect
@@ -46,7 +43,10 @@
 
 from .astutils import (UNSAFE_ATTRS, HAS_NUMPY, make_symbol_table, numpy,
                        op2func, ExceptionHolder, ReturnedNone,
-                       valid_symbol_name, check_pyversion)
+                       valid_symbol_name)
+
+if version_info[0] < 3 or version_info[1] < 5:
+    raise SystemError("Python 3.5 or higher required")
 
 builtins = __builtins__
 if not isinstance(builtins, dict):
@@ -57,12 +57,9 @@
              'dict', 'ellipsis', 'excepthandler', 'expr', 'extslice',
              'for', 'functiondef', 'if', 'ifexp', 'index', 'interrupt',
              'list', 'listcomp', 'module', 'name', 'nameconstant', 'num',
-             'pass', 'print', 'raise', 'repr', 'return', 'slice', 'str',
+             'pass', 'raise', 'repr', 'return', 'slice', 'str',
              'subscript', 'try', 'tuple', 'unaryop', 'while', 'constant']
 
-
-PY3 = check_pyversion()
-
 class Interpreter(object):
     """create an asteval Interpreter: a restricted, simplified interpreter
     of mathematical expressions using Python syntax.
@@ -132,11 +129,6 @@
                 usersyms = {}
             symtable = make_symbol_table(use_numpy=use_numpy, **usersyms)
 
-        if no_print:
-            symtable['print'] = self._nullprinter
-        else:
-            symtable['print'] = self._printer
-
         self.symtable = symtable
         self._interrupt = None
         self.error = []
@@ -147,6 +139,9 @@
         self.start_time = time.time()
         self.use_numpy = HAS_NUMPY and use_numpy
 
+        symtable['print'] = self._printer
+        self.no_print = no_print or minimal
+
         nodes = ALL_NODES[:]
 
         if minimal or no_if:
@@ -167,8 +162,6 @@
             nodes.remove('delete')
         if minimal or no_raise:
             nodes.remove('raise')
-        if minimal or no_print:
-            nodes.remove('print')
         if minimal or no_listcomp:
             nodes.remove('listcomp')
         if minimal or no_augassign:
@@ -616,26 +609,10 @@
                 out = out and r
         return out
 
-
-    def on_print(self, node):    # ('dest', 'values', 'nl')
-        """Note: implements Python2 style print statement, not print()
-        function.
-        May need improvement....
-        """
-        dest = self.run(node.dest) or self.writer
-        end = ''
-        if node.nl:
-            end = '\n'
-        out = [self.run(tnode) for tnode in node.values]
-        if out and len(self.error) == 0:
-            self._printer(*out, file=dest, end=end)
-
-    def _nullprinter(self, *out, **kws):
-        """swallow print calls"""
-        pass
-
     def _printer(self, *out, **kws):
         """Generic print function."""
+        if self.no_print:
+            return
         flush = kws.pop('flush', True)
         fileh = kws.pop('file', self.writer)
         sep = kws.pop('sep', ' ')
@@ -739,12 +716,8 @@
 
     def on_raise(self, node):    # ('type', 'inst', 'tback')
         """Raise statement: note difference for python 2 and 3."""
-        if PY3:
-            excnode = node.exc
-            msgnode = node.cause
-        else:
-            excnode = node.type
-            msgnode = node.inst
+        excnode = node.exc
+        msgnode = node.cause
         out = self.run(excnode)
         msg = ' '.join(out.args)
         msg2 = self.run(msgnode)
@@ -766,7 +739,7 @@
             args = args + self.run(starargs)
 
         keywords = {}
-        if PY3 and func == print:
+        if func == print:
             keywords['file'] = self.writer
 
         for key in node.keywords:
@@ -782,9 +755,10 @@
         try:
             return func(*args, **keywords)
         except Exception as ex:
+            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))
+                "kwargs %s: %s" % (func_name, args, keywords, ex))
 
     def on_arg(self, node):    # ('test', 'msg')
         """Arg for function definitions."""
@@ -807,10 +781,7 @@
             keyval = self.run(node.args.args[idef+offset])
             kwargs.append((keyval, defval))
 
-        if PY3:
-            args = [tnode.arg for tnode in node.args.args[:offset]]
-        else:
-            args = [tnode.id for tnode in node.args.args[:offset]]
+        args = [tnode.arg for tnode in node.args.args[:offset]]
         doc = None
         nb0 = node.body[0]
         if isinstance(nb0, ast.Expr) and isinstance(nb0.value, ast.Str):
@@ -818,9 +789,9 @@
 
         varkws = node.args.kwarg
         vararg = node.args.vararg
-        if PY3 and isinstance(vararg, ast.arg):
+        if isinstance(vararg, ast.arg):
             vararg = vararg.arg
-        if PY3 and isinstance(varkws, ast.arg):
+        if isinstance(varkws, ast.arg):
             varkws = varkws.arg
 
         self.symtable[node.name] = Procedure(node.name, self, doc=doc,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/asteval/astutils.py 
new/asteval-0.9.18/asteval/astutils.py
--- old/asteval-0.9.17/asteval/astutils.py      2019-11-14 21:19:47.000000000 
+0100
+++ new/asteval-0.9.18/asteval/astutils.py      2019-12-17 18:36:32.000000000 
+0100
@@ -4,30 +4,15 @@
    Matthew Newville <[email protected]>,
    The University of Chicago
 """
-from __future__ import division, print_function
 import io
 import re
 import ast
 import math
 import numbers
-from sys import exc_info, version_info
-from tokenize import NAME as tk_NAME
-
-def check_pyversion():
-    version_major, version_minor = version_info[0],  version_info[1]
-    if version_major == 3 and version_minor < 5:
-        raise SystemError("Python 3.0 to 3.4 are not supported")
-    if version_major == 2 and version_minor < 7:
-        raise SystemError("Python 2.6 or earlier are not supported")
-    return version_major == 3
-
-
-if version_info > (3, 4):
-    from tokenize import tokenize as generate_tokens, ENCODING as tk_ENCODING
-else:
-    from tokenize import generate_tokens
-    tk_ENCODING = None
-
+from sys import exc_info
+from tokenize import (tokenize as generate_tokens,
+                      ENCODING as tk_ENCODING,
+                      NAME as tk_NAME)
 
 HAS_NUMPY = False
 numpy = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/asteval.egg-info/PKG-INFO 
new/asteval-0.9.18/asteval.egg-info/PKG-INFO
--- old/asteval-0.9.17/asteval.egg-info/PKG-INFO        2019-11-14 
22:13:24.000000000 +0100
+++ new/asteval-0.9.18/asteval.egg-info/PKG-INFO        2019-12-17 
18:36:52.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: asteval
-Version: 0.9.17
+Version: 0.9.18
 Summary: Safe, minimalistic evaluator of python expression using ast module
 Home-page: http://github.com/newville/asteval
 Author: Matthew Newville
@@ -22,4 +22,4 @@
 Classifier: Intended Audience :: Science/Research
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/asteval.egg-info/SOURCES.txt 
new/asteval-0.9.18/asteval.egg-info/SOURCES.txt
--- old/asteval-0.9.17/asteval.egg-info/SOURCES.txt     2019-11-14 
22:13:24.000000000 +0100
+++ new/asteval-0.9.18/asteval.egg-info/SOURCES.txt     2019-12-17 
18:36:52.000000000 +0100
@@ -1,11 +1,7 @@
-.gitattributes
-.gitignore
-.travis.yml
 INSTALL
 LICENSE
 MANIFEST.in
 README.rst
-requirements.txt
 setup.cfg
 setup.py
 versioneer.py
@@ -26,6 +22,4 @@
 doc/motivation.rst
 doc/_static/empty
 doc/_templates/indexsidebar.html
-tests/A.py
-tests/m.py
 tests/test_asteval.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/doc/basics.rst 
new/asteval-0.9.18/doc/basics.rst
--- old/asteval-0.9.17/doc/basics.rst   2019-11-14 21:19:47.000000000 +0100
+++ new/asteval-0.9.18/doc/basics.rst   2019-12-17 18:36:32.000000000 +0100
@@ -20,10 +20,10 @@
 that is very much like python::
 
     >>> aeval('x = sqrt(3)')
-    >>> aeval('print x')
+    >>> aeval('print(x)')
     1.73205080757
     >>> aeval('''for i in range(10):
-    print i, sqrt(i), log(1+1)
+    print(i, sqrt(i), log(1+1))
     ''')
     0 0.0 0.0
     1 1.0 0.69314718056
@@ -50,7 +50,7 @@
     >>> aeval.symtable['x']
     1.73205080757
     >>> aeval.symtable['y'] = 100
-    >>> aeval('print y/8')
+    >>> aeval('print(y/8)')
     12.5
 
 Note here the use of true division even though the operands are integers.
@@ -133,13 +133,10 @@
 printing
 ===============
 
-For printing, asteval emulates Python's native :func:`print` function (for
-Python 3) and :data:`print` statement (for Python 2).  That is, the
-behavior mimics the version of Python used.
-
-You can change where output is sent with the ``writer`` argument when
-creating the interpreter.  By default, outputs are sent to
-:py:data:`sys.stdout`.
+For printing, asteval emulates Python's native :func:`print` function.  You
+can change where output is sent with the ``writer`` argument when creating
+the interpreter, or supreess printing all together with the ``no_print``
+option.  By default, outputs are sent to :py:data:`sys.stdout`.
 
 
 writing functions
@@ -162,9 +159,9 @@
 ===============
 
 Asteval monitors and caches exceptions in the evaluated code.  Brief error
-messages are printed (with Python's print statement or function, and so
-using standard output by default), and the full set of exceptions is kept
-in the :attr:`error` attribute of the :class:`Interpreter` instance.  This
+messages are printed (with Python's print function, and so using standard
+output by default), and the full set of exceptions is kept in the
+:attr:`error` attribute of the :class:`Interpreter` instance.  This
 :attr:`error` attribute is a list of instances of the asteval
 :class:`ExceptionHolder` class, which is accessed through the
 :meth:`get_error` method.  The :attr:`error` attribute is reset to an empty
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/doc/installation.rst 
new/asteval-0.9.18/doc/installation.rst
--- old/asteval-0.9.17/doc/installation.rst     2019-11-14 21:34:24.000000000 
+0100
+++ new/asteval-0.9.18/doc/installation.rst     2019-12-17 18:36:32.000000000 
+0100
@@ -12,8 +12,9 @@
 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.
 
-Version 0.9.17 supports and is tested with Python 2.7, Python 3.5 through 3.8.
-This is the final version to support Python 2.7.
+Version 0.9.18 supports and is tested with Python 3.5 through 3.8.
+
+Version 0.9.17 was the last version to support Python 2.7.
 
 
 Download and Installation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/requirements.txt 
new/asteval-0.9.18/requirements.txt
--- old/asteval-0.9.17/requirements.txt 2019-11-14 21:19:47.000000000 +0100
+++ new/asteval-0.9.18/requirements.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-##
-## pip requirements file.  To install dependencies, use
-##
-##  pip install -r requirements.txt
-## numpy>=1.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/setup.py new/asteval-0.9.18/setup.py
--- old/asteval-0.9.17/setup.py 2019-11-14 21:19:47.000000000 +0100
+++ new/asteval-0.9.18/setup.py 2019-12-17 18:36:32.000000000 +0100
@@ -22,7 +22,7 @@
       author_email='[email protected]',
       url='http://github.com/newville/asteval',
       license = 'OSI Approved :: MIT License',
-      python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
+      python_requires='>=3.5',
       description="Safe, minimalistic evaluator of python expression using ast 
module",
       long_description=long_description,
       packages=['asteval'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/tests/A.py 
new/asteval-0.9.18/tests/A.py
--- old/asteval-0.9.17/tests/A.py       2018-09-21 02:52:44.000000000 +0200
+++ new/asteval-0.9.18/tests/A.py       1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-import sys
-from asteval import Interpreter
-aeval = Interpreter()
-
-script = """
-def tmp(x):
-    return tmp(x+1)
-##
-"""
-
-aeval(script)
-
-for rec_limit in (50, 100, 200, 500, 1000, 2000, 5000, 10000):
-    sys.setrecursionlimit(rec_limit)
-    aeval('tmp(33)')
-    msg = aeval.error_msg
-    if msg is not None:
-        print("rec limit=%d, length of error messge=%d" % (rec_limit,  
len(msg)))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/tests/m.py 
new/asteval-0.9.18/tests/m.py
--- old/asteval-0.9.17/tests/m.py       2018-09-21 02:33:45.000000000 +0200
+++ new/asteval-0.9.18/tests/m.py       1970-01-01 01:00:00.000000000 +0100
@@ -1,8 +0,0 @@
-from asteval import Interpreter
-
-aeval = Interpreter()
-
-text = """
-def foo():
-    return foo()
-"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asteval-0.9.17/tests/test_asteval.py 
new/asteval-0.9.18/tests/test_asteval.py
--- old/asteval-0.9.17/tests/test_asteval.py    2019-11-14 21:19:47.000000000 
+0100
+++ new/asteval-0.9.18/tests/test_asteval.py    2019-12-17 18:36:32.000000000 
+0100
@@ -3,24 +3,20 @@
 Base TestCase for asteval
 """
 import ast
+import math
 import os
 import textwrap
 import time
 import unittest
 import pytest
+from io import StringIO
 
+from functools import partial
 from sys import version_info
 from tempfile import NamedTemporaryFile
 
+from asteval import NameFinder, Interpreter, make_symbol_table
 
-from asteval import NameFinder, Interpreter, make_symbol_table, check_pyversion
-
-PY3 = check_pyversion()
-
-if PY3:
-    from io import StringIO
-else:
-    from cStringIO import StringIO
 
 
 HAS_NUMPY = False
@@ -440,11 +436,9 @@
         """names test"""
         self.interp('nx = 1')
         self.interp('nx1 = 1')
-
-        if PY3:
-            # use \u escape b/c python 2 complains about file encoding
-            self.interp('\u03bb = 1')
-            self.interp('\u03bb1 = 1')
+        # use \u escape b/c python 2 complains about file encoding
+        self.interp('\u03bb = 1')
+        self.interp('\u03bb1 = 1')
 
     def test_syntaxerrors_1(self):
         """assignment syntax errors test"""
@@ -626,7 +620,7 @@
         for w in ('True', 'False'):
             self.interp.error = []
             self.interp("%s= 2" % w)
-            self.check_error('SyntaxError' if PY3 else 'NameError')
+            self.check_error('SyntaxError')
 
         for w in ('eval', '__import__'):
             self.interp.error = []
@@ -866,13 +860,13 @@
         self.interp('open("foo1", "wb")')
         self.check_error('RuntimeError')
         self.interp('open("foo2", "rb")')
-        self.check_error('FileNotFoundError' if PY3 else 'IOError')
+        self.check_error('FileNotFoundError')
         self.interp('open("foo3", "rb", 2<<18)')
         self.check_error('RuntimeError')
 
     def test_recursionlimit(self):
         self.interp("""def foo(): return foo()\nfoo()""")
-        self.check_error('RecursionError' if PY3 else 'RuntimeError')
+        self.check_error('RecursionError')
 
     def test_kaboom(self):
         """ test Ned Batchelder's 'Eval really is dangerous' - Kaboom test 
(and related tests)"""
@@ -883,10 +877,8 @@
 
         self.interp(
             """[print(c) for c in 
().__class__.__bases__[0].__subclasses__()]""")  # Try a portion of the 
kaboom...
-        if PY3:
-            self.check_error('AttributeError', '__class__')  # Safe, unsafe 
dunders are not supported
-        else:
-            self.check_error('SyntaxError')
+
+        self.check_error('AttributeError', '__class__')  # Safe, unsafe 
dunders are not supported
         self.interp("9**9**9**9**9**9**9**9")
         self.check_error('RuntimeError')  # Safe, safe_pow() catches this
         self.interp(
@@ -1032,6 +1024,23 @@
         self.assertTrue(aeval("a_dict['a'] == 1"))
         self.assertTrue(aeval("a_dict['c'] == 3"))
 
+    def test_partial_exception(self):
+        sym_table = make_symbol_table(sqrt=partial(math.sqrt))
+
+        aeval = Interpreter(symtable=sym_table)
+
+        assert aeval("sqrt(4)") == 2
+
+        # Calling sqrt(-1) should raise a ValueError. When the interpreter
+        # encounters an exception, it attempts to form an error string that
+        # uses the function's __name__ attribute. Partials don't have a
+        # __name__ attribute, so we want to make sure that an AttributeError is
+        # not raised.
+    
+        result = aeval("sqrt(-1)")
+        assert aeval.error.pop().exc == ValueError
+
+
 class TestCase2(unittest.TestCase):
     def test_stringio(self):
         """ test using stringio for output/errors """


Reply via email to