Skip to content
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

Pyright hanging a vscode process when analyzing requests library #82

Closed
microcoder opened this issue Apr 22, 2019 · 6 comments
Closed
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@microcoder
Copy link

microcoder commented Apr 22, 2019

Describe the bug
Pyright hanging a vscode process when openned at vscode the requests library

To Reproduce
Create a new python file and import the requests library:

import requests

Then click CTRL + Left mouse click to open the requests library. After then a vscode process hangup.

@erictraut
Copy link
Collaborator

Thanks for the bug report. Which version of the Pyright extension are you running? There was a bug in 1.0.15 that could explain this. It's fixed in 1.0.16. I'm not able to repro the problem with the latest version.

@microcoder
Copy link
Author

microcoder commented Apr 22, 2019

@erictraut I am use last version of Pyright 1.0.16 and VS Code last version - 1.33.1

When i opening the requests:
Screenshot_20190422_112656

Pyright uses 100% a core of CPU and do not stopped:

Screenshot_20190422_112721
Screenshot_20190422_112749

@erictraut erictraut added the bug Something isn't working label Apr 22, 2019
@erictraut
Copy link
Collaborator

Ah, I was opening the stub file, and you were opening the implementation file. I'm now able to repro the problem. I'll dig into it and work on a fix.

@microcoder
Copy link
Author

@erictraut Thank You!

@erictraut
Copy link
Collaborator

The bug is triggered by code in the requests module that performs the following:

for v in vs
   if <condition>
      v = [v]

This causes pyright to infer the type of v to be either X or List[X]. As it analyzes the loop, it adds more variants (List[List[X]], List[List[List[X]]], etc.). This results in an infinite loop.

I've added a partial fix that prevents infinite recursion in this particular case, but I'd like to find a more general fix. I'm going to leave this bug open until I've fully fixed the problem.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label May 5, 2019
@erictraut
Copy link
Collaborator

I've fixed the underlying root cause of the problem in 1.0.24

heejaechang pushed a commit to heejaechang/pyright that referenced this issue Nov 3, 2021
fixed issue introduced by my previous fourslash changes where wild ca…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants