-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
astroid infinite loop when encountering comparison operator #764
Comments
Thanks for the report @smontanaro ! I'm afraid I can't reproduce it, does the reproduction requires some additional steps? Here's my output using the same version as you:
************* Module regopcodes Your code has been rated at 5.17/10 (previous run: 5.17/10, +0.00) Could you maybe post the traceback as well? |
Thanks for the quick response @PCManticore. I thought it very strange that it would barf on such a basic thing, but couldn't make it go away. I've attached the traceback. Let me know if I can provide more data. |
@PCManticore Is there anything I can do to help debug this problem? |
Hey @smontanaro I'm afraid I still can't reproduce it with
From the traceback it seems the recursion starts when checking for Can you also post the Sorry for not having more ideas, it would be great if I'd manage to reproduce it. |
I've now tried with three different versions of Python
Note that the attached opcode.py (from my git repo) contains a few extra instructions. I'm working on a translator from Python's stack virtual machine into a register-based virtual machine. :-) Still, I have tried now with three different versions of Python, so while my (uninstalled) Lib/opcode.py file is used when running with my sandbox Python, the other two won't use it. Also, at this stage, no register instructions are written to .pyc files, so pylint shouldn't encounter anything weird and annoying. Since the /usr/bin/python3 use is new, here's the version info from it:
I'll work on the other debug recommendations and comment separately. Might not be for a day or two. |
This was simpler than I anticipated. I tweaked /home/skip/miniconda3/envs/python38/lib/python3.8/site-packages/pylint/checkers/base.py to print the node to stderr. The infinite recursion seems to be triggered in the assert statement at the very end of lib/rattlesnake/opcodes.py. Here's the printed node:
If I comment out the assert statement, the pylint command runs to completion. So, here's the command I'm running right now (from the top of my git checkout):
My CPython fork is here: https://github.com/python/cpython and I'm running off the register branch. As of this writing my checkout is up-to-date with what you see. (At the moment, I'm mostly fussing with C code trying to stamp out refleaks, so the Python code might not change much in the next couple days.) I messed around briefly with lower levels of the traceback, but didn't really understand what I was doing, so gave up pretty quickly. |
Hey @smontanaro I was able to reproduce it using your instructions, thanks. |
Good that you can reproduce it and great that you were able to offer a workaround. Edit: One last followup from me on this. I eventually eliminated the opcodes module from my project, but .../Lib/opcode.py is similarly modified to use "+=". I needed to boost the recursion limit a bit higher (2750 failed, but 2875 worked). Since my first report, I've implemented a fair number of new instructions, so it's understandable that the recursion limit needed to be increased. |
Steps to reproduce
Current behavior
Infinite loop when it encounters the expression
op >= opcode.HAVE_ARGUMENT
Expected behavior
No infinite loop
Output of pylint --version:
pylint 2.4.4
astroid 2.3.3
Python 3.8.1 (default, Jan 8 2020, 22:29:32)
[GCC 7.3.0]
regopcodes.txt
The text was updated successfully, but these errors were encountered: