Closed tushar-deepsource closed 8 months ago
We had this problem several time, but I'm not sure that silently failing all the time with an inference error is better for genuinely large recursions or genuinely big calculation. Maybe we should catch the RecursionError or use a timeout, but raise a warning...
Yeah, sounds good to me.
I have often voted against catching RecursionErrors
too broadly. Often it is just a sign of poorly written code, although I must confess in this case I don't see an immediate fix.
What doesn't help is that I think the calls to all the decorators that we use in astroid
make us hit the error sooner?
This specific example no longer reproduces on pylint 3.0.3. We have other open issues about recursion where we can take up the question of what to do, e.g. #8842.
I have often voted against catching RecursionErrors too broadly. Often it is just a sign of poorly written code, although I must confess in this case I don't see an immediate fix.
We want pylint to be used on code that needs help. It won't ever be adopted if it crashes when people try to first use it. The fact that astroid
uses recursive algorithms is an implementation detail we shouldn't blame on the code being linted.
Bug description
Pylint throws an F0002 while trying to lint a file with large enough inferences, here's a minimal example:
This can be handled and caught in astroid during inference, rather than reporting it to the user.
Configuration
No response
Command used
Pylint output
Expected behavior
No
F0002
Pylint version
OS / Environment
No response
Additional dependencies
No response