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

Several crashes on pyright test suite #14201

Closed
hauntsaninja opened this issue Nov 27, 2022 · 3 comments · Fixed by #14556
Closed

Several crashes on pyright test suite #14201

hauntsaninja opened this issue Nov 27, 2022 · 3 comments · Fixed by #14556
Labels
crash topic-pep-572 PEP 572 (walrus operator) topic-pep-646 PEP 646 (TypeVarTuple, Unpack)

Comments

@hauntsaninja
Copy link
Collaborator

https://github.com/microsoft/pyright/tree/main/packages/pyright-internal/src/tests/samples

assignment1.py
assignmentExpr4.py
super1.py
unpack1.py

The crash on unpack1.py is probably most worth looking into

~/dev/pyright/packages/pyright-internal/src/tests/samples main λ mypy --show-traceback assignment1.py
assignment1.py:58: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.991
Traceback (most recent call last):
  File "mypy/semanal.py", line 6047, in accept
  File "mypy/nodes.py", line 1236, in accept
  File "mypy/semanal.py", line 4264, in visit_expression_stmt
  File "mypy/nodes.py", line 2213, in accept
  File "mypy/semanal.py", line 4945, in visit_list_comprehension
  File "mypy/nodes.py", line 2198, in accept
  File "mypy/semanal.py", line 4968, in visit_generator_expr
  File "mypy/nodes.py", line 1928, in accept
  File "mypy/semanal.py", line 2518, in visit_assignment_expr
  File "mypy/semanal.py", line 3428, in analyze_lvalue
  File "mypy/semanal.py", line 3477, in analyze_name_lvalue
  File "mypy/semanal.py", line 5882, in current_symbol_table
AssertionError: Escaping comprehension from invalid scope
assignment1.py:58: : note: use --pdb to drop into pdb
~/dev/pyright/packages/pyright-internal/src/tests/samples main λ mypy --show-traceback assignmentExpr4.py
assignmentExpr4.py:38: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.991
Traceback (most recent call last):
  File "mypy/semanal.py", line 6047, in accept
  File "mypy/nodes.py", line 1236, in accept
  File "mypy/semanal.py", line 4264, in visit_expression_stmt
  File "mypy/nodes.py", line 2213, in accept
  File "mypy/semanal.py", line 4945, in visit_list_comprehension
  File "mypy/nodes.py", line 2198, in accept
  File "mypy/semanal.py", line 4968, in visit_generator_expr
  File "mypy/nodes.py", line 1928, in accept
  File "mypy/semanal.py", line 2518, in visit_assignment_expr
  File "mypy/semanal.py", line 3428, in analyze_lvalue
  File "mypy/semanal.py", line 3477, in analyze_name_lvalue
  File "mypy/semanal.py", line 5882, in current_symbol_table
AssertionError: Escaping comprehension from invalid scope
assignmentExpr4.py:38: : note: use --pdb to drop into pdb
~/dev/pyright/packages/pyright-internal/src/tests/samples main λ mypy --show-traceback super1.py
super1.py:39: error: "super" with a single argument not supported  [misc]
super1.py:42: error: "super" with a single argument not supported  [misc]
super1.py:49: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.991
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 4665, in accept
  File "mypy/nodes.py", line 2085, in accept
  File "mypy/checkexpr.py", line 4308, in visit_super_expr
AssertionError: 
super1.py:49: : note: use --pdb to drop into pdb
~/dev/pyright/packages/pyright-internal/src/tests/samples main λ mypy --show-traceback unpack1.py
unpack1.py:27: error: Argument 1 to "int_only" has incompatible type "object"; expected "int"  [arg-type]
unpack1.py:31: error: Argument 1 to "int_only" has incompatible type "object"; expected "int"  [arg-type]
unpack1.py:34: error: Can use starred expression only as assignment target  [misc]
unpack1.py:42: error: "reveal_type" expects 1 argument  [misc]
unpack1.py:45: error: "reveal_type" expects 1 argument  [misc]
unpack1.py:48: error: "reveal_type" expects 1 argument  [misc]
unpack1.py:34: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.991
Traceback (most recent call last):
  File "mypy/checker.py", line 573, in accept
  File "mypy/nodes.py", line 1301, in accept
  File "mypy/checker.py", line 2620, in visit_assignment_stmt
  File "mypy/checker.py", line 2848, in check_assignment
  File "mypy/erasetype.py", line 185, in remove_instance_last_known_values
  File "mypy/types.py", line 2530, in accept
AssertionError: 
unpack1.py:34: : note: use --pdb to drop into pdb
@AlexWaygood AlexWaygood added topic-pep-572 PEP 572 (walrus operator) topic-pep-646 PEP 646 (TypeVarTuple, Unpack) labels Nov 27, 2022
@ilevkivskyi
Copy link
Member

Btw I think I added the super crash, should be an easy fix.

@ilevkivskyi
Copy link
Member

And here is a fix #14208

@ilevkivskyi
Copy link
Member

Hm, example with * unpacking doesn't crash anymore. I will submit a PR with a test, and a fix for the assignment expression crash.

hauntsaninja pushed a commit that referenced this issue Jan 29, 2023
Fixes #14201

The fix is trivial, turn an assert condition into a blocker error (with
message matching Python syntax error). I also add a test case for a
crash from the same issue that looks already fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash topic-pep-572 PEP 572 (walrus operator) topic-pep-646 PEP 646 (TypeVarTuple, Unpack)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants