-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugbear 21.4.1 + 21.4.2 fails with AttributeError #164
Comments
Same here, was just filing an issue myself: We have automating lint checks with flake8 with bugbear running and it looks like the latest release from about an hour ago broke something. Here is what we are getting now AttributeError: 'Name' object has no attribute 'func' Was running fine until then. We are calling this with: Or are we doing something wrong? Thanks |
No, this seems like a bug we will need to repro with tests and fix. Two workarounds are:
I will try find cycles tonight, but my day is very busy. PR welcome. cc: @cricalix |
@xqt - could you give me a sample line of code that this is breaking on? I'm thinking I can fix with a |
Please test with #165 - There might be more edge cases but I think this will get it. |
21.4.2 released. Will yank 21.4.1 from PyPI. |
@ambv - Can you please yank 21.4.1, I don't have access. |
Unfortunately with 21.4.2 I still experience:
(was |
We need some code examples please to add to the unit test code to ensure we fix. Please pin to old version for now. I’d ya k the versions but I can’t. My express release didn’t help. Sorry. Going to need more conditions. |
Hmm. Naive approach that's the fastest fix is possibly to put a try block on that whole set of code, and let it silently fail. Not the nicest way though, and we lose the bug reports that would enable me to improve the code. The error you're getting says that you've got a line of code that triggers as being a function, having the attr attribute in the AST node for the Call, the attr is assertRaises, there's one argument (I was deliberately avoiding assertRaises(Exception, Bob)), and yet whatever that AST node is, it doesn't have an id attribute. Do you have code that does something like self.assertRaises("string") @DStape ? |
Since i can't yank I'd like to forward fix or do something crude to stop people's CI dying all over the world ... |
I have a somewhat forward fix about to go up, but I really can't tell if I'm fixing all the cases of the problem. Adding another condition to the tree walk to check the type of element for args[0]. |
@cooperlees, @cricalix , here's a stripped down example of code bugbear is error-ing out on for us:
Note that when |
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. |
K, #166 is up for review. |
And yeah, it's a messy set of stuff in the merge; I haven't used git for several years now, and it shows. I can drop my fork and re-do the submission if needed. |
Difficult to give a code sample, our framework has 50.000 LOC. All I can say is that our tests passes with Python 3.5.7 but failed due to this issue with Python 3.6.9. There is one difference: Python 3.6 tests require mwparserfromhell and bs4 to be installed. And Python 3.5 uses BB 19.8.0. Anyway this issue is solved with 21.4.3: Thank you |
21.4.3 works for me now. (21.4.1 was broken for me even though I don't use |
Works for me too. Thanks for the fix! |
Newly updated bugbear 21.4.1 fails with AttributeError:
See https://integration.wikimedia.org/ci/job/pywikibot-core-tox-docker/14952/console
The text was updated successfully, but these errors were encountered: