bugbear 21.4.1 + 21.4.2 fails with AttributeError
See original GitHub issueNewly updated bugbear 21.4.1 fails with AttributeError:
21:06:51 Traceback (most recent call last):
21:06:51 File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
21:06:51 result = (True, func(*args, **kwds))
21:06:51 File "/usr/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
21:06:51 return list(map(*args))
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/flake8/checker.py", line 676, in _run_checks
21:06:51 return checker.run_checks()
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/flake8/checker.py", line 589, in run_checks
21:06:51 self.run_ast_checks()
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/flake8/checker.py", line 494, in run_ast_checks
21:06:51 for (line_number, offset, text, _) in runner:
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 36, in run
21:06:51 visitor.visit(self.tree)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 165, in visit
21:06:51 super().visit(node)
21:06:51 File "/usr/lib/python3.6/ast.py", line 253, in visit
21:06:51 return visitor(node)
21:06:51 File "/usr/lib/python3.6/ast.py", line 261, in generic_visit
21:06:51 self.visit(item)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 165, in visit
21:06:51 super().visit(node)
21:06:51 File "/usr/lib/python3.6/ast.py", line 253, in visit
21:06:51 return visitor(node)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 306, in visit_ClassDef
21:06:51 self.generic_visit(node)
21:06:51 File "/usr/lib/python3.6/ast.py", line 261, in generic_visit
21:06:51 self.visit(item)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 165, in visit
21:06:51 super().visit(node)
21:06:51 File "/usr/lib/python3.6/ast.py", line 253, in visit
21:06:51 return visitor(node)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 302, in visit_FunctionDef
21:06:51 self.generic_visit(node)
21:06:51 File "/usr/lib/python3.6/ast.py", line 261, in generic_visit
21:06:51 self.visit(item)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 165, in visit
21:06:51 super().visit(node)
21:06:51 File "/usr/lib/python3.6/ast.py", line 253, in visit
21:06:51 return visitor(node)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 321, in visit_With
21:06:51 self.check_for_b017(node)
21:06:51 File "/src/.tox/flake8-py36/lib/python3.6/site-packages/bugbear.py", line 442, in check_for_b017
21:06:51 hasattr(item_context.func, "attr")
21:06:51 AttributeError: 'Name' object has no attribute 'func'
21:06:51 """
See https://integration.wikimedia.org/ci/job/pywikibot-core-tox-docker/14952/console
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:18 (6 by maintainers)
Top Results From Across the Web
Flake8-bugbear: A Plugin for Flake8 Finding Likely Bugs
Flake8-bugbear: A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and ...
Read more >A plugin for Flake8 finding likely bugs and design problems in your ...
A cause of fear, anxiety, or irritation: *Overcrowding is often a bugbear for train commuters.* 2. ... bugbear 21.4.1 + 21.4.2 fails with...
Read more >The flake8-bugbear from PyCQA - Coder Social
A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle. from...
Read more >mypy plugin for loguru - PythonRepo
Raising an exception turns into an internal error for mypy which is ... Handler] AttributeError: module 'loguru' has no attribute 'Writable'.
Read more >Ontology Components - DocShare.tips
21.4.1 Morgan's early influence . . . . . . . . . . . . . . . . . . ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ok, test case added, and confirms that my in-flight fix fixes that case. I’ll have to walk the AST tree to get a better feel for what your syntax is doing, but it looks like there’s another layer of nesting in that case.
@cooperlees, @cricalix , here’s a stripped down example of code bugbear is error-ing out on for us:
Note that when
CancelledErroris imported fromasyncio, theAttributeErrordoes not occur.