-
-
Notifications
You must be signed in to change notification settings - Fork 297
Closed
Labels
Crash 💥Needs PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Steps to reproduce
The following code triggers an AttributeError
in astroid:
s = slice(-2)
@s()
@six.add_metaclass()
class a: ...
This bug was discovered by OSS-Fuzz:
https://issues.oss-fuzz.com/issues/409585564 (report not public yet)
Current behavior
Traceback (most recent call last):
File "pylint/lint/pylinter.py", line 994, in get_ast
return MANAGER.ast_from_file(filepath, modname, source=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/manager.py", line 165, in ast_from_file
return AstroidBuilder(self).file_build(filepath, modname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/builder.py", line 145, in file_build
return self._post_build(module, builder, encoding)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/builder.py", line 173, in _post_build
module = self._manager.visit_transforms(module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/manager.py", line 129, in visit_transforms
return self._transform.visit(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/transforms.py", line 162, in visit
return self._visit(node)
^^^^^^^^^^^^^^^^^
File "astroid/transforms.py", line 84, in _visit
visited = self._visit_generic(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/transforms.py", line 112, in _visit_generic
return [self._visit_generic(child) for child in node]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/transforms.py", line 112, in <listcomp>
return [self._visit_generic(child) for child in node]
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/transforms.py", line 119, in _visit_generic
return self._visit(node)
^^^^^^^^^^^^^^^^^
File "astroid/transforms.py", line 87, in _visit
return self._transform(node)
^^^^^^^^^^^^^^^^^^^^^
File "astroid/transforms.py", line 67, in _transform
ret = transform_func(node)
^^^^^^^^^^^^^^^^^^^^
File "astroid/brain/brain_six.py", line 185, in transform_six_add_metaclass
if func.qname() == SIX_ADD_METACLASS and decorator.args:
^^^^^^^^^^
AttributeError: 'Slice' object has no attribute 'qname'
Expected behavior
No crash
Version
Metadata
Metadata
Assignees
Labels
Crash 💥Needs PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation