Closed harenbrs closed 3 years ago
Thanks for reporting the bug.
We've identified and fixed one potential cause for this. Please try the next release of Pylance (which should be published in the next couple of days) and let us know if you still see the problem.
This issue has been fixed in version 2021.1.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202111-13-january-2021
I am now on Pylance language server 2021.1.1 (pyright 6a970b45)
but I am still experiencing this error on Python 3.8.6, as well as an apparently different error on 3.9.1.
I have since published the "offending" source code here. Open the file pyclee/clusters.py
for analysis.
Stack trace for 3.8.6:
An internal error occurred while type checking file "/Users/seb/tmp/pyclee/pyclee/clusters.py": RangeError: Maximum call stack size exceeded
at Object.lookUpClassMember (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeUtils.ts:711:17)
at forEach (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:14970:34)
at Map.forEach (<anonymous>)
at canAssignClassToProtocol (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:14953:25)
at canAssignClass (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:15383:20)
at canAssignType (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:16386:22)
at partiallySpecializeFunctionForBoundClassOrObject (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:17723:25)
at bindFunctionToClassOrObject (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:17591:24)
at /Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:15019:63
at Map.forEach (<anonymous>)Pylance
Stack trace for 3.9.1:
An internal error occurred while type checking file "/Users/seb/tmp/pyclee/pyclee/clusters.py": RangeError: Maximum call stack size exceeded
at canAssignClass (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:15350:14)
at canAssignType (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:16386:22)
at assignTypeToTypeVar (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:15936:18)
at canAssignType (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:16056:24)
at partiallySpecializeFunctionForBoundClassOrObject (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:17723:25)
at bindFunctionToClassOrObject (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:17591:24)
at forEach (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:15009:58)
at Map.forEach (<anonymous>)
at canAssignClassToProtocol (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:14953:25)
at Fn (/Users/seb/.vscode/extensions/ms-python.vscode-pylance-2021.1.1/dist/pyright-internal/src/analyzer/typeEvaluator.ts:15383:20)Pylance
@harenbrs, thanks for the repro steps. I was able to find and fix the problem. You are using NewType
with a protocol class, which is something we've never seen before. That was causing infinite recursion within the type analyzer. The fix will be included in the next release.
Excellent, many thanks for dealing with it so quickly. Also happy to be making history, of a kind 😉
This issue has been fixed in version 2021.1.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202112-20-january-2021
dont think its been resolved as im having that issue right now.
The original bug was definitely fixed. If you're experiencing a similar symptom, please file a new bug. And if you can provide a minimal code snippet that exhibits the problem, that would be really helpful.
Environment data
Expected behaviour
Type checking functions correctly
Actual behaviour
Type checking throws an error at the top of the file
Logs
Code Snippet / Additional information
Code is closed source at the moment, and I haven't been able to find a minimum-reproducible example.
The stack trace to my eyes looks different from the recently closed similar issues.