Hello community, here is the log from the commit of package python-astroid for openSUSE:Factory checked in at 2014-12-08 16:56:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-astroid (Old) and /work/SRC/openSUSE:Factory/.python-astroid.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-astroid" Changes: -------- --- /work/SRC/openSUSE:Factory/python-astroid/python-astroid.changes 2014-11-24 11:09:13.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-astroid.new/python-astroid.changes 2014-12-08 16:56:49.000000000 +0100 @@ -1,0 +2,11 @@ +Mon Dec 8 12:11:48 UTC 2014 - mcihar@suse.cz + +- Update to 1.3.2: + * Fixed a crash with invalid subscript index. + * Implement proper base class semantics for Python 3, where + every class derives from object. + * Allow more fine-grained control over C extension loading + in the manager. + * Fixed a crash issue with the pytest brain module. + +------------------------------------------------------------------- Old: ---- astroid-1.3.0.tar.gz New: ---- astroid-1.3.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-astroid.spec ++++++ --- /var/tmp/diff_new_pack.UccaTG/_old 2014-12-08 16:56:50.000000000 +0100 +++ /var/tmp/diff_new_pack.UccaTG/_new 2014-12-08 16:56:50.000000000 +0100 @@ -17,7 +17,7 @@ Name: python-astroid -Version: 1.3.0 +Version: 1.3.2 Release: 0 Url: http://bitbucket.org/logilab/astroid Summary: Rebuild a new abstract syntax tree from Python's ast ++++++ astroid-1.3.0.tar.gz -> astroid-1.3.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/ChangeLog new/astroid-1.3.2/ChangeLog --- old/astroid-1.3.0/ChangeLog 2014-11-20 21:52:51.000000000 +0100 +++ new/astroid-1.3.2/ChangeLog 2014-11-22 15:49:40.000000000 +0100 @@ -1,6 +1,20 @@ Change log for the astroid package (used to be astng) ===================================================== +2014-11-22 -- 1.3.2 + + * Fixed a crash with invalid subscript index. + + * Implement proper base class semantics for Python 3, where + every class derives from object. + + * Allow more fine-grained control over C extension loading + in the manager. + +2014-11-21 -- 1.3.1 + + * Fixed a crash issue with the pytest brain module. + 2014-11-20 -- 1.3.0 * Fix a maximum recursion error occured during the inference, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/PKG-INFO new/astroid-1.3.2/PKG-INFO --- old/astroid-1.3.0/PKG-INFO 2014-11-20 22:10:42.000000000 +0100 +++ new/astroid-1.3.2/PKG-INFO 2014-11-22 15:51:42.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: astroid -Version: 1.3.0 +Version: 1.3.2 Summary: A abstract syntax tree for Python with inference support. Home-page: http://bitbucket.org/logilab/astroid Author: Logilab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/__pkginfo__.py new/astroid-1.3.2/astroid/__pkginfo__.py --- old/astroid-1.3.0/astroid/__pkginfo__.py 2014-11-20 21:52:22.000000000 +0100 +++ new/astroid-1.3.2/astroid/__pkginfo__.py 2014-11-22 15:49:50.000000000 +0100 @@ -20,7 +20,7 @@ modname = 'astroid' -numversion = (1, 3, 0) +numversion = (1, 3, 2) version = '.'.join([str(num) for num in numversion]) install_requires = ['logilab-common >= 0.60.0', 'six'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/brain/py2pytest.py new/astroid-1.3.2/astroid/brain/py2pytest.py --- old/astroid-1.3.0/astroid/brain/py2pytest.py 2014-11-15 16:58:32.000000000 +0100 +++ new/astroid-1.3.2/astroid/brain/py2pytest.py 2014-11-21 22:37:51.000000000 +0100 @@ -5,7 +5,7 @@ def pytest_transform(): - fake = AstroidBuilder(MANAGER).string_build(''' + return AstroidBuilder(MANAGER).string_build(''' try: import _pytest.mark diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/brain/py2stdlib.py new/astroid-1.3.2/astroid/brain/py2stdlib.py --- old/astroid-1.3.0/astroid/brain/py2stdlib.py 2014-11-20 21:52:22.000000000 +0100 +++ new/astroid-1.3.2/astroid/brain/py2stdlib.py 2014-11-22 11:58:05.000000000 +0100 @@ -95,20 +95,20 @@ class %(name)s(object): def __init__(self, value=''): pass def digest(self): - return u'' + return %(digest)s def copy(self): return self def update(self, value): pass def hexdigest(self): - return u'' + return '' @property def name(self): return %(name)r ''' - algorithms = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512') - classes = "".join(template % {'name': hashfunc} - for hashfunc in algorithms) + classes = "".join( + template % {'name': hashfunc, 'digest': 'b""' if PY3K else '""'} + for hashfunc in algorithms) return AstroidBuilder(MANAGER).string_build(classes) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/builder.py new/astroid-1.3.2/astroid/builder.py --- old/astroid-1.3.0/astroid/builder.py 2014-11-18 20:18:06.000000000 +0100 +++ new/astroid-1.3.2/astroid/builder.py 2014-11-20 22:50:04.000000000 +0100 @@ -44,7 +44,7 @@ def open_source_file(filename): with open(filename, 'rb') as byte_stream: encoding = detect_encoding(byte_stream.readline)[0] - stream = open(filename, 'rU', encoding=encoding) + stream = open(filename, 'r', newline=None, encoding=encoding) try: data = stream.read() except UnicodeError: # wrong encodingg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/inference.py new/astroid-1.3.2/astroid/inference.py --- old/astroid-1.3.0/astroid/inference.py 2014-11-13 22:15:14.000000000 +0100 +++ new/astroid-1.3.2/astroid/inference.py 2014-11-22 13:46:05.000000000 +0100 @@ -283,6 +283,12 @@ except (IndexError, TypeError): yield YES return + + # Prevent inferring if the infered subscript + # is the same as the original subscripted object. + if self is assigned: + yield YES + return for infered in assigned.infer(context): yield infered else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/manager.py new/astroid-1.3.2/astroid/manager.py --- old/astroid-1.3.0/astroid/manager.py 2014-11-20 21:52:22.000000000 +0100 +++ new/astroid-1.3.2/astroid/manager.py 2014-11-22 14:05:49.000000000 +0100 @@ -89,6 +89,8 @@ self._mod_file_cache = {} self.transforms = collections.defaultdict(list) self._failed_import_hooks = [] + self.always_load_extensions = False + self.extension_package_whitelist = set() def ast_from_file(self, filepath, modname=None, fallback=True, source=False): """given a module name, return the astroid object""" @@ -116,6 +118,16 @@ from astroid.builder import AstroidBuilder return AstroidBuilder(self).string_build('', modname) + def _can_load_extension(self, modname): + if self.always_load_extensions: + return True + if modutils.is_standard_module(modname): + return True + parts = modname.split('.') + return any( + '.'.join(parts[:x]) in self.extension_package_whitelist + for x in range(1, len(parts) + 1)) + def ast_from_module_name(self, modname, context_file=None): """given a module name, return the astroid object""" if modname in self.astroid_cache: @@ -132,7 +144,7 @@ if module is not None: return module elif mp_type in (imp.C_BUILTIN, imp.C_EXTENSION): - if mp_type == imp.C_EXTENSION and not modutils.is_standard_module(modname): + if mp_type == imp.C_EXTENSION and not self._can_load_extension(modname): return self._build_stub_module(modname) try: module = modutils.load_module_from_name(modname) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/scoped_nodes.py new/astroid-1.3.2/astroid/scoped_nodes.py --- old/astroid-1.3.0/astroid/scoped_nodes.py 2014-11-17 20:31:10.000000000 +0100 +++ new/astroid-1.3.2/astroid/scoped_nodes.py 2014-11-22 14:37:08.000000000 +0100 @@ -952,17 +952,17 @@ def callable(self): return True - def _is_subtype_of(self, type_name): + def is_subtype_of(self, type_name, context=None): if self.qname() == type_name: return True - for anc in self.ancestors(): + for anc in self.ancestors(context=context): if anc.qname() == type_name: return True def infer_call_result(self, caller, context=None): """infer what a class is returning when called""" - if self._is_subtype_of('%s.type' % (BUILTINS,)) and len(caller.args) == 3: - name_node = next(caller.args[0].infer()) + if self.is_subtype_of('%s.type' % (BUILTINS,), context) and len(caller.args) == 3: + name_node = next(caller.args[0].infer(context)) if (isinstance(name_node, Const) and isinstance(name_node.value, six.string_types)): name = name_node.value @@ -970,7 +970,7 @@ yield YES return result = Class(name, None) - bases = next(caller.args[1].infer()) + bases = next(caller.args[1].infer(context)) if isinstance(bases, (Tuple, List)): result.bases = bases.itered() else: @@ -1013,6 +1013,11 @@ yielded = set([self]) if context is None: context = InferenceContext() + if sys.version_info[0] >= 3: + if not self.bases and self.qname() != 'builtins.object': + yield builtin_lookup("object")[1][0] + return + for stmt in self.bases: try: for baseobj in stmt.infer(context): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/tests/unittest_brain.py new/astroid-1.3.2/astroid/tests/unittest_brain.py --- old/astroid-1.3.0/astroid/tests/unittest_brain.py 2014-11-08 23:26:38.000000000 +0100 +++ new/astroid-1.3.2/astroid/tests/unittest_brain.py 2014-11-21 22:46:46.000000000 +0100 @@ -21,10 +21,12 @@ from astroid import MANAGER from astroid import bases +from astroid import nodes from astroid import test_utils import astroid -class HashlibTC(unittest.TestCase): + +class HashlibTest(unittest.TestCase): def test_hashlib(self): """Tests that brain extensions for hashlib work.""" hashlib_module = MANAGER.ast_from_module_name('hashlib') @@ -78,9 +80,9 @@ self.assertIs(bases.YES, next(klass.infer())) + @unittest.skipIf(sys.version_info[0] > 2, + 'namedtuple inference is broken on Python 3') def test_namedtuple_advanced_inference(self): - if sys.version_info[0] > 2: - self.skipTest('Currently broken for Python 3.') # urlparse return an object of class ParseResult, which has a # namedtuple call and a mixin as base classes result = test_utils.extract_node(""" @@ -95,5 +97,13 @@ instance.getattr('foo') +class ModuleExtenderTest(unittest.TestCase): + def testExtensionModules(self): + for extender, _ in MANAGER.transforms[nodes.Module]: + n = nodes.Module('__main__', None) + extender(n) + + + if __name__ == '__main__': unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/tests/unittest_inference.py new/astroid-1.3.2/astroid/tests/unittest_inference.py --- old/astroid-1.3.0/astroid/tests/unittest_inference.py 2014-11-11 21:11:15.000000000 +0100 +++ new/astroid-1.3.2/astroid/tests/unittest_inference.py 2014-11-22 13:46:05.000000000 +0100 @@ -273,7 +273,7 @@ def test_ancestors_inference(self): code = ''' - class A: #@ + class A(object): #@ pass class A(A): #@ @@ -281,12 +281,12 @@ ''' a1, a2 = test_utils.extract_node(code, __name__) a2_ancestors = list(a2.ancestors()) - self.assertEqual(len(a2_ancestors), 1) + self.assertEqual(len(a2_ancestors), 2) self.assertIs(a2_ancestors[0], a1) def test_ancestors_inference2(self): code = ''' - class A: #@ + class A(object): #@ pass class B(A): #@ @@ -297,7 +297,7 @@ ''' a1, b, a2 = test_utils.extract_node(code, __name__) a2_ancestors = list(a2.ancestors()) - self.assertEqual(len(a2_ancestors), 2) + self.assertEqual(len(a2_ancestors), 3) self.assertIs(a2_ancestors[0], b) self.assertIs(a2_ancestors[1], a1) @@ -1357,6 +1357,31 @@ node = astroid['do_a_thing'] self.assertEqual(node.type, 'function') + def test_no_infinite_ancestor_loop(self): + klass = test_utils.extract_node(""" + import datetime + + def method(self): + datetime.datetime = something() + + class something(datetime.datetime): #@ + pass + """) + self.assertIn( + 'object', + [base.name for base in klass.ancestors()]) + + def test_stop_iteration_leak(self): + code = """ + class Test: + def __init__(self): + self.config = {0: self.config[0]} + self.config[0].test() #@ + """ + astroid = test_utils.extract_node(code, __name__) + expr = astroid.func.expr + self.assertIs(next(expr.infer()), YES) + if __name__ == '__main__': unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/tests/unittest_nodes.py new/astroid-1.3.2/astroid/tests/unittest_nodes.py --- old/astroid-1.3.0/astroid/tests/unittest_nodes.py 2014-11-11 21:33:27.000000000 +0100 +++ new/astroid-1.3.2/astroid/tests/unittest_nodes.py 2014-11-20 23:14:20.000000000 +0100 @@ -31,7 +31,7 @@ abuilder = builder.AstroidBuilder() -class AsStringTest(unittest.TestCase): +class AsStringTest(resources.SysPathSetup, unittest.TestCase): def test_tuple_as_string(self): def build(string): @@ -429,6 +429,5 @@ '(no line number on function args)') - if __name__ == '__main__': unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid/tests/unittest_scoped_nodes.py new/astroid-1.3.2/astroid/tests/unittest_scoped_nodes.py --- old/astroid-1.3.0/astroid/tests/unittest_scoped_nodes.py 2014-11-17 20:31:10.000000000 +0100 +++ new/astroid-1.3.2/astroid/tests/unittest_scoped_nodes.py 2014-11-22 00:49:29.000000000 +0100 @@ -530,7 +530,14 @@ anc_klass = next(it) self.assertIsInstance(anc_klass, nodes.Class) self.assertEqual(anc_klass.name, 'YO') - self.assertRaises(StopIteration, partial(next, it)) + if sys.version_info[0] == 2: + self.assertRaises(StopIteration, partial(next, it)) + else: + anc_klass = next(it) + self.assertIsInstance(anc_klass, nodes.Class) + self.assertEqual(anc_klass.name, 'object') + self.assertRaises(StopIteration, partial(next, it)) + it = klass2.local_attr_ancestors('method') self.assertRaises(StopIteration, partial(next, it)) @@ -546,26 +553,22 @@ self.assertRaises(StopIteration, partial(next, it)) def test_methods(self): + expected_methods = {'__init__', 'class_method', 'method', 'static_method'} klass2 = self.module['YOUPI'] - methods = sorted([m.name for m in klass2.methods()]) - self.assertEqual(methods, ['__init__', 'class_method', - 'method', 'static_method']) - methods = [m.name for m in klass2.mymethods()] - methods.sort() - self.assertEqual(methods, ['__init__', 'class_method', - 'method', 'static_method']) + methods = {m.name for m in klass2.methods()} + self.assertTrue( + methods.issuperset(expected_methods)) + methods = {m.name for m in klass2.mymethods()} + self.assertSetEqual(expected_methods, methods) klass2 = self.module2['Specialization'] - methods = [m.name for m in klass2.mymethods()] - methods.sort() - self.assertEqual(methods, []) + methods = {m.name for m in klass2.mymethods()} + self.assertSetEqual(set([]), methods) method_locals = klass2.local_attr('method') self.assertEqual(len(method_locals), 1) self.assertEqual(method_locals[0].name, 'method') self.assertRaises(NotFoundError, klass2.local_attr, 'nonexistant') - methods = [m.name for m in klass2.methods()] - methods.sort() - self.assertEqual(methods, ['__init__', 'class_method', - 'method', 'static_method']) + methods = {m.name for m in klass2.methods()} + self.assertTrue(methods.issuperset(expected_methods)) #def test_rhs(self): # my_dict = self.module['MY_DICT'] @@ -575,13 +578,19 @@ # self.assertIsInstance(value, nodes.Const) # self.assertEqual(value.value, 1) + @unittest.skipIf(sys.version_info[0] >= 3, "Python 2 class semantics required.") def test_ancestors(self): klass = self.module['YOUPI'] - ancs = [a.name for a in klass.ancestors()] - self.assertEqual(ancs, ['YO']) + self.assertEqual(['YO'], [a.name for a in klass.ancestors()]) + klass = self.module2['Specialization'] + self.assertEqual(['YOUPI', 'YO'], [a.name for a in klass.ancestors()]) + + @unittest.skipIf(sys.version_info[0] < 3, "Python 3 class semantics required.") + def test_ancestors_py3(self): + klass = self.module['YOUPI'] + self.assertEqual(['YO', 'object'], [a.name for a in klass.ancestors()]) klass = self.module2['Specialization'] - ancs = [a.name for a in klass.ancestors()] - self.assertEqual(ancs, ['YOUPI', 'YO']) + self.assertEqual(['YOUPI', 'YO', 'object'], [a.name for a in klass.ancestors()]) def test_type(self): klass = self.module['YOUPI'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/astroid.egg-info/PKG-INFO new/astroid-1.3.2/astroid.egg-info/PKG-INFO --- old/astroid-1.3.0/astroid.egg-info/PKG-INFO 2014-11-20 22:10:39.000000000 +0100 +++ new/astroid-1.3.2/astroid.egg-info/PKG-INFO 2014-11-22 15:51:38.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: astroid -Version: 1.3.0 +Version: 1.3.2 Summary: A abstract syntax tree for Python with inference support. Home-page: http://bitbucket.org/logilab/astroid Author: Logilab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/setup.py new/astroid-1.3.2/setup.py --- old/astroid-1.3.0/setup.py 2014-11-12 22:01:11.000000000 +0100 +++ new/astroid-1.3.2/setup.py 2014-11-22 15:04:17.000000000 +0100 @@ -18,7 +18,9 @@ # You should have received a copy of the GNU Lesser General Public License along # with astroid. If not, see http://www.gnu.org/licenses/. """Setup script for astroid.""" +import os from setuptools import setup, find_packages +from setuptools.command import install_lib pkginfo = 'astroid/__pkginfo__.py' @@ -28,6 +30,13 @@ with open('README') as fobj: long_description = fobj.read() +class AstroidInstallLib(install_lib.install_lib): + def byte_compile(self, files): + test_datadir = os.path.join('astroid', 'tests', 'testdata') + files = [f for f in files if test_datadir not in f] + install_lib.install_lib.byte_compile(self, files) + + def install(): return setup(name = distname, @@ -42,6 +51,7 @@ include_package_data = True, install_requires = install_requires, packages = find_packages(), + cmdclass={'install_lib': AstroidInstallLib} ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.3.0/tox.ini new/astroid-1.3.2/tox.ini --- old/astroid-1.3.0/tox.ini 2014-11-17 20:50:25.000000000 +0100 +++ new/astroid-1.3.2/tox.ini 2014-11-20 23:14:45.000000000 +0100 @@ -6,4 +6,4 @@ deps = logilab-common six -commands = python -Wi -m unittest discover -s {envsitepackagesdir}/astroid/tests -p "unittest*.py" +commands = python -m unittest discover -s {envsitepackagesdir}/astroid/tests -p "unittest*.py" -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org