-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
AttributeError: 'NoneType' object has no attribute 'bases' #1319
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
Comments
It would be helpful if you could narrow this crash down to a small code fragment. It's not obvious how |
Also possibly try if this is fixed with the head from the repo?
|
ok, I've tried with I've tracked it down to the libsass library and specifically to importing its Calling import _sass |
Thanks for reporting this crash! This slightly hacky repro works for me, sidestepping the question of getting MYPYPATH right:
I get a traceback that looks just like yours. I haven't succeeded in reproducing it with that one-line version -- I suspect the trigger is something else in that sass.py file. The traceback also suggests that to me, because it looks like it's a few layers deep in the AST of the file. We have a mechanism for catching internal errors and reporting the source file and line that triggered them, but this one seems to have slipped past it. I'll file a bug for that. That'll probably be the easiest way to spot exactly what's causing this crash. |
Ha, actually on looking at the node types indicated in that traceback, I narrowed it down to a class definition inside a conditional block. There aren't many of those, and it turns out to be a line in six, not anything in libsass itself. Here's a reduced test case:
Same traceback. |
Thanks for the repro, Greg! This should be easy enough to fix, I expect
it's in the slightly hacky code to deal with conditional definitions. I'm
guessing it's not properly handing the case where one of the branches
leaves the class undefined.
|
Interestingly this is sensitive to the name of the PY3 variable, which is built into mypy as a known constant (with value dependent on pyversion), and |
Skip unreachable blocks in ThirdPass. Fixes #1319.
with
mypy-lang==0.3.1
. I think this is in an imported module not my code asunset MYPYPATH
stops the exception.The text was updated successfully, but these errors were encountered: