Hello community, here is the log from the commit of package python-astroid for openSUSE:Factory checked in at 2020-06-21 18:51:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-astroid (Old) and /work/SRC/openSUSE:Factory/.python-astroid.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-astroid" Sun Jun 21 18:51:50 2020 rev:24 rq:814800 version:2.4.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-astroid/python-astroid.changes 2020-05-28 09:08:01.859827058 +0200 +++ /work/SRC/openSUSE:Factory/.python-astroid.new.3606/python-astroid.changes 2020-06-21 19:03:05.572361467 +0200 @@ -1,0 +2,7 @@ +Tue Jun 16 02:59:27 UTC 2020 - Steve Kowalik <[email protected]> + +- Update to 2.4.2: + * `FunctionDef.is_generator` properly handles `yield` nodes in `While` tests + * Properly construct the arguments of infered property descriptors + +------------------------------------------------------------------- Old: ---- astroid-2.4.1.tar.gz New: ---- astroid-2.4.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-astroid.spec ++++++ --- /var/tmp/diff_new_pack.9jyqeN/_old 2020-06-21 19:03:05.988362818 +0200 +++ /var/tmp/diff_new_pack.9jyqeN/_new 2020-06-21 19:03:05.992362831 +0200 @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-astroid -Version: 2.4.1 +Version: 2.4.2 Release: 0 Summary: Representation of Python source as an AST for pylint License: LGPL-2.1-or-later ++++++ astroid-2.4.1.tar.gz -> astroid-2.4.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/ChangeLog new/astroid-2.4.2/ChangeLog --- old/astroid-2.4.1/ChangeLog 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/ChangeLog 2020-06-08 08:51:41.000000000 +0200 @@ -2,6 +2,19 @@ astroid's ChangeLog =================== +What's New in astroid 2.4.2? +============================ +Release Date: 2020-06-08 + +* `FunctionDef.is_generator` properly handles `yield` nodes in `While` tests + + Close PyCQA/pylint#3519 + +* Properly construct the arguments of infered property descriptors + + Close PyCQA/pylint#3648 + + What's New in astroid 2.4.1? ============================ Release Date: 2020-05-05 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/PKG-INFO new/astroid-2.4.2/PKG-INFO --- old/astroid-2.4.1/PKG-INFO 2020-05-05 09:44:53.000000000 +0200 +++ new/astroid-2.4.2/PKG-INFO 2020-06-08 08:53:04.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: astroid -Version: 2.4.1 +Version: 2.4.2 Summary: An abstract syntax tree for Python with inference support. Home-page: https://github.com/PyCQA/astroid Author: Python Code Quality Authority diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/__pkginfo__.py new/astroid-2.4.2/astroid/__pkginfo__.py --- old/astroid-2.4.1/astroid/__pkginfo__.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/__pkginfo__.py 2020-06-08 08:51:41.000000000 +0200 @@ -21,7 +21,7 @@ """astroid packaging information""" -version = "2.4.1" +version = "2.4.2" numversion = tuple(int(elem) for elem in version.split(".") if elem.isdigit()) extras_require = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/bases.py new/astroid-2.4.2/astroid/bases.py --- old/astroid-2.4.1/astroid/bases.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/bases.py 2020-06-08 08:51:41.000000000 +0200 @@ -486,7 +486,7 @@ if new_cls: return iter((new_cls,)) - return super(BoundMethod, self).infer_call_result(caller, context) + return super().infer_call_result(caller, context) def bool_value(self, context=None): return True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/builder.py new/astroid-2.4.2/astroid/builder.py --- old/astroid-2.4.1/astroid/builder.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/builder.py 2020-06-08 08:51:41.000000000 +0200 @@ -77,7 +77,7 @@ # pylint: disable=redefined-outer-name def __init__(self, manager=None, apply_transforms=True): - super(AstroidBuilder, self).__init__() + super().__init__() self._manager = manager or MANAGER self._apply_transforms = apply_transforms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/exceptions.py new/astroid-2.4.2/astroid/exceptions.py --- old/astroid-2.4.1/astroid/exceptions.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/exceptions.py 2020-06-08 08:51:41.000000000 +0200 @@ -28,7 +28,7 @@ """ def __init__(self, message="", **kws): - super(AstroidError, self).__init__(message) + super().__init__(message) self.message = message for key, value in kws.items(): setattr(self, key, value) @@ -46,7 +46,7 @@ """ def __init__(self, message="Failed to import module {modname}.", **kws): - super(AstroidBuildingError, self).__init__(message, **kws) + super().__init__(message, **kws) class AstroidImportError(AstroidBuildingError): @@ -69,7 +69,7 @@ message="Relative import with too many levels " "({level}) for module {name!r}", **kws ): - super(TooManyLevelsError, self).__init__(message, **kws) + super().__init__(message, **kws) class AstroidSyntaxError(AstroidBuildingError): @@ -89,7 +89,7 @@ name = None def __init__(self, message="{func!r} has no default for {name!r}.", **kws): - super(NoDefault, self).__init__(message, **kws) + super().__init__(message, **kws) class ResolveError(AstroidError): @@ -157,7 +157,7 @@ context = None def __init__(self, message="Inference failed for {node!r}.", **kws): - super(InferenceError, self).__init__(message, **kws) + super().__init__(message, **kws) # Why does this inherit from InferenceError rather than ResolveError? @@ -175,7 +175,7 @@ scope = None def __init__(self, message="{name!r} not found in {scope!r}.", **kws): - super(NameInferenceError, self).__init__(message, **kws) + super().__init__(message, **kws) class AttributeInferenceError(ResolveError): @@ -191,7 +191,7 @@ attribute = None def __init__(self, message="{attribute!r} not found on {target!r}.", **kws): - super(AttributeInferenceError, self).__init__(message, **kws) + super().__init__(message, **kws) class UseInferenceDefault(Exception): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/interpreter/_import/spec.py new/astroid-2.4.2/astroid/interpreter/_import/spec.py --- old/astroid-2.4.1/astroid/interpreter/_import/spec.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/interpreter/_import/spec.py 2020-06-08 08:51:41.000000000 +0200 @@ -184,7 +184,7 @@ """Finder that knows how to find a module inside zip files.""" def __init__(self, path): - super(ZipFinder, self).__init__(path) + super().__init__(path) self._zipimporters = _precache_zipimporters(path) def find_module(self, modname, module_parts, processed, submodule_path): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/interpreter/objectmodel.py new/astroid-2.4.2/astroid/interpreter/objectmodel.py --- old/astroid-2.4.1/astroid/interpreter/objectmodel.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/interpreter/objectmodel.py 2020-06-08 08:51:41.000000000 +0200 @@ -743,6 +743,27 @@ """Model for a builtin property""" # pylint: disable=import-outside-toplevel + def _init_function(self, name): + from astroid.node_classes import Arguments + from astroid.scoped_nodes import FunctionDef + + args = Arguments() + args.postinit( + args=[], + defaults=[], + kwonlyargs=[], + kw_defaults=[], + annotations=[], + posonlyargs=[], + posonlyargs_annotations=[], + kwonlyargs_annotations=[], + ) + + function = FunctionDef(name=name, parent=self._instance) + + function.postinit(args=args, body=[]) + return function + @property def attr_fget(self): from astroid.scoped_nodes import FunctionDef @@ -767,20 +788,14 @@ @property def attr_setter(self): - from astroid.scoped_nodes import FunctionDef - - return FunctionDef(name="setter", parent=self._instance) + return self._init_function("setter") @property def attr_deleter(self): - from astroid.scoped_nodes import FunctionDef - - return FunctionDef(name="deleter", parent=self._instance) + return self._init_function("deleter") @property def attr_getter(self): - from astroid.scoped_nodes import FunctionDef - - return FunctionDef(name="getter", parent=self._instance) + return self._init_function("getter") # pylint: enable=import-outside-toplevel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/node_classes.py new/astroid-2.4.2/astroid/node_classes.py --- old/astroid-2.4.1/astroid/node_classes.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/node_classes.py 2020-06-08 08:51:41.000000000 +0200 @@ -990,7 +990,7 @@ :type: list(NodeNG) """ - super(_BaseContainer, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, elts): """Do some setup after initialisation. @@ -1286,7 +1286,7 @@ :type: str or None """ - super(AssignName, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) class DelName( @@ -1326,7 +1326,7 @@ :type: str or None """ - super(DelName, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) class Name(mixins.NoChildrenMixin, LookupMixIn, NodeNG): @@ -1367,7 +1367,7 @@ :type: str or None """ - super(Name, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def _get_name_nodes(self): yield self @@ -1439,7 +1439,7 @@ :param parent: The parent node in the syntax tree. :type parent: NodeNG or None """ - super(Arguments, self).__init__(parent=parent) + super().__init__(parent=parent) self.vararg = vararg """The name of the variable length arguments. @@ -1626,7 +1626,7 @@ :type: int or None """ - lineno = super(Arguments, self).fromlineno + lineno = super().fromlineno return max(lineno, self.parent.fromlineno or 0) @decorators.cachedproperty @@ -1846,7 +1846,7 @@ :type: str or None """ - super(AssignAttr, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, expr=None): """Do some setup after initialisation. @@ -2065,7 +2065,7 @@ :type: str or None """ - super(AugAssign, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, target=None, value=None): """Do some setup after initialisation. @@ -2178,7 +2178,7 @@ :type: str or None """ - super(BinOp, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, left=None, right=None): """Do some setup after initialisation. @@ -2266,7 +2266,7 @@ :type: str or None """ - super(BoolOp, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, values=None): """Do some setup after initialisation. @@ -2464,7 +2464,7 @@ :param parent: The parent node in the syntax tree. :type parent: NodeNG or None """ - super(Comprehension, self).__init__() + super().__init__() self.parent = parent # pylint: disable=redefined-builtin; same name as builtin ast module. @@ -2561,7 +2561,7 @@ :type: object """ - super(Const, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def __getattr__(self, name): # This is needed because of Proxy's __getattr__ method. @@ -2742,7 +2742,7 @@ :type: str or None """ - super(DelAttr, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, expr=None): """Do some setup after initialisation. @@ -2815,7 +2815,7 @@ :type: list(tuple(NodeNG, NodeNG)) """ - super(Dict, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, items): """Do some setup after initialisation. @@ -3347,7 +3347,7 @@ :type: int """ - super(ImportFrom, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) class Attribute(NodeNG): @@ -3382,7 +3382,7 @@ :type: str or None """ - super(Attribute, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, expr=None): """Do some setup after initialisation. @@ -3427,7 +3427,7 @@ :type: list(str) """ - super(Global, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def _infer_name(self, frame, name): return name @@ -3595,7 +3595,7 @@ :type: list(tuple(str, str or None)) or None """ - super(Import, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) class Index(NodeNG): @@ -3668,7 +3668,7 @@ :type: Name or None """ - super(Keyword, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, value=None): """Do some setup after initialisation. @@ -3713,7 +3713,7 @@ :type: Context or None """ - super(List, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def pytype(self): """Get the name of the type that this node represents. @@ -3768,7 +3768,7 @@ :type: list(str) """ - super(Nonlocal, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def _infer_name(self, frame, name): return name @@ -3824,7 +3824,7 @@ :type: bool or None """ - super(Print, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, dest=None, values=None): """Do some setup after initialisation. @@ -4077,9 +4077,7 @@ :type: Context or None """ - super(Starred, self).__init__( - lineno=lineno, col_offset=col_offset, parent=parent - ) + super().__init__(lineno=lineno, col_offset=col_offset, parent=parent) def postinit(self, value=None): """Do some setup after initialisation. @@ -4135,9 +4133,7 @@ :type: Context or None """ - super(Subscript, self).__init__( - lineno=lineno, col_offset=col_offset, parent=parent - ) + super().__init__(lineno=lineno, col_offset=col_offset, parent=parent) # pylint: disable=redefined-builtin; had to use the same name as builtin ast module. def postinit(self, value=None, slice=None): @@ -4330,7 +4326,7 @@ :type: Context or None """ - super(Tuple, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def pytype(self): """Get the name of the type that this node represents. @@ -4386,7 +4382,7 @@ :type: str or None """ - super(UnaryOp, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, operand=None): """Do some setup after initialisation. @@ -4500,6 +4496,11 @@ yield from self.body yield from self.orelse + def _get_yield_nodes_skip_lambdas(self): + """A While node can contain a Yield node in the test""" + yield from self.test._get_yield_nodes_skip_lambdas() + yield from super()._get_yield_nodes_skip_lambdas() + class With( mixins.MultiLineBlockMixin, @@ -4768,7 +4769,7 @@ def __init__(self, original, value): self.original = original self.value = value - super(EvaluatedObject, self).__init__( + super().__init__( lineno=self.original.lineno, col_offset=self.original.col_offset, parent=self.original.parent, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid/scoped_nodes.py new/astroid-2.4.2/astroid/scoped_nodes.py --- old/astroid-2.4.1/astroid/scoped_nodes.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/astroid/scoped_nodes.py 2020-06-08 08:51:41.000000000 +0200 @@ -814,7 +814,7 @@ :type: dict(str, NodeNG) """ - super(GeneratorExp, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, elt=None, generators=None): """Do some setup after initialisation. @@ -890,7 +890,7 @@ :type: dict(str, NodeNG) """ - super(DictComp, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, key=None, value=None, generators=None): """Do some setup after initialisation. @@ -966,7 +966,7 @@ :type: dict(str, NodeNG) """ - super(SetComp, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, elt=None, generators=None): """Do some setup after initialisation. @@ -1062,7 +1062,7 @@ :type: dict(str, NodeNG) """ - super(ListComp, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def _infer_decorator_callchain(node): @@ -1162,7 +1162,7 @@ :type: list(NodeNG) """ - super(Lambda, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) def postinit(self, args, body): """Do some setup after initialisation. @@ -1367,7 +1367,7 @@ """ self.instance_attrs = {} - super(FunctionDef, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) if parent: frame = parent.frame() frame.set_local(name, self) @@ -1661,7 +1661,7 @@ :returns: True is this is a generator function, False otherwise. :rtype: bool """ - return next(self._get_yield_nodes_skip_lambdas(), False) + return bool(next(self._get_yield_nodes_skip_lambdas(), False)) def infer_call_result(self, caller=None, context=None): """Infer what the function returns when called. @@ -1974,7 +1974,7 @@ :type doc: str or None """ - super(ClassDef, self).__init__(lineno, col_offset, parent) + super().__init__(lineno, col_offset, parent) if parent is not None: parent.frame().set_local(name, self) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/astroid.egg-info/PKG-INFO new/astroid-2.4.2/astroid.egg-info/PKG-INFO --- old/astroid-2.4.1/astroid.egg-info/PKG-INFO 2020-05-05 09:44:53.000000000 +0200 +++ new/astroid-2.4.2/astroid.egg-info/PKG-INFO 2020-06-08 08:53:03.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: astroid -Version: 2.4.1 +Version: 2.4.2 Summary: An abstract syntax tree for Python with inference support. Home-page: https://github.com/PyCQA/astroid Author: Python Code Quality Authority diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/tests/unittest_inference.py new/astroid-2.4.2/tests/unittest_inference.py --- old/astroid-2.4.1/tests/unittest_inference.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/tests/unittest_inference.py 2020-06-08 08:51:41.000000000 +0200 @@ -5846,5 +5846,22 @@ assert len(test) == 2 +def test_infer_generated_setter(): + code = """ + class A: + @property + def test(self): + pass + A.test.setter + """ + node = extract_node(code) + inferred = next(node.infer()) + assert isinstance(inferred, nodes.FunctionDef) + assert isinstance(inferred.args, nodes.Arguments) + # This line used to crash because property generated functions + # did not have args properly set + assert list(inferred.nodes_of_class(nodes.Const)) == [] + + if __name__ == "__main__": unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.4.1/tests/unittest_nodes.py new/astroid-2.4.2/tests/unittest_nodes.py --- old/astroid-2.4.1/tests/unittest_nodes.py 2020-05-05 09:43:24.000000000 +0200 +++ new/astroid-2.4.2/tests/unittest_nodes.py 2020-06-08 08:51:41.000000000 +0200 @@ -1335,5 +1335,17 @@ assert [elem.value for elem in itered] == list("string") +def test_is_generator_for_yield_in_while(): + code = """ + def paused_iter(iterable): + while True: + # Continue to yield the same item until `next(i)` or `i.send(False)` + while (yield value): + pass + """ + node = astroid.extract_node(code) + assert bool(node.is_generator()) + + if __name__ == "__main__": unittest.main()
