-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
RuntimeError: generator raised StopIteration #2317
RuntimeError: generator raised StopIteration #2317
Comments
Does this still occur after fully upgrading both If it's still reproducable, can you provide a minimal, verifiable example? |
Yes, it claim latest versions are installed. I will try to get it down to class/method but probably only tomorrow. Will also try to rebuild virtualenv from scratch. There is only one, single file in whole project that fails like this. |
Actually, it was easier than I thought:
is enough to trigger same exception. Without |
In terms of astroid, whatever I try to do it always pulls version 2.0, which gets reported by pylint as 2.0.0.dev4. |
If you look in I can reproduce; this bug only occurs with Python 3.7 pip freeze:
|
Here's a reproduction without django: class ContextMixin:
def get_context_data(self, **kwargs):
return kwargs
class DVM(ContextMixin):
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
return ctx
class IFDVM(DVM):
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
ctx['bar'] = 'foo'
return ctx |
Even simpler way to reproduce
|
Upgrading to astroid 2.0 fixed my issue |
Correct, doesn't error on 2.0.0 (astroid) - must be different issue then. |
Just upgraded astroid, but still getting the same error.
|
With next versions everything works fine for me:
|
This issue concerns pylint 2.0.0. |
Empty generators and next calls within a generator without a default argument now cause a cascade effect which results in a RuntimeError. Raise InferenceError instead of return None to avoid the above problem. Close pylint-dev/pylint#2317
Issue still present on:
|
My PR to fix this is still in the process of being reviewed |
…ethods. Bryce Guinta (4): Add new Changelog heading Fix changelog section underline Add test for checking that a RuntimeError is no longer emitted in Python 3.7 Fix lint error Claudiu Popa (6): Fix unused import Add note to remove the already built dists Rename method for making it clearer Wrap the inference functions with raise_if_nothing_inferred where we didn't have any guards against them infer_call_result can raise InferenceError so make sure to handle that for the call sites where it is used Prepare 2.0.2 Nick Drozd (1): Cut obsolete "explicit StopIteration" comments Ville Skyttä (2): Spelling fixes Use final Python 3.7 in Travis What's New in astroid 2.0.2? ============================ Release Date: 2018-08-01 * Stop repeat inference attempt causing a RuntimeError in Python3.7 Close pylint-dev/pylint#2317 * infer_call_result can raise InferenceError so make sure to handle that for the call sites where it is used infer_call_result started recently to raise InferenceError for objects for which it could not find any returns. Previously it was silently raising a StopIteration, which was especially leaking when calling builtin methods. (NEWS truncated at 15 lines)
Steps to reproduce
Current behavior
Expected behavior
Report as normal.
pylint --version output
The text was updated successfully, but these errors were encountered: