Skip to content

Revert "Now lambda is counted as a valid context in …" #11694

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

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Dec 9, 2021

This reverts commit d37c2be.

Lambdas can't be safely deferred. There are various subtle assumptions about
lambdas not being deferred in different parts of the codebase, and figuring out
how to do this safely is almost certainly not worth the trouble. This would be
very difficult to validate, since lambda deferral would probably happen very
rarely in practice.

Also, I've seen some crashes which might be caused by this (not sure though).

@JukkaL
Copy link
Collaborator Author

JukkaL commented Dec 9, 2021

cc @sobolevn

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2021

Diff from mypy_primer, showing the effect of this PR on open source code:

graphql-core (https://github.com/graphql-python/graphql-core)
- tests/execution/test_union_interface.py:69: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:75: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:76: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:77: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:87: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:88: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:89: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:100: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:101: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:102: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:127: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:128: error: Unused "type: ignore" comment
- tests/execution/test_union_interface.py:129: error: Unused "type: ignore" comment

@JukkaL JukkaL merged commit a1f785e into master Dec 9, 2021
@JukkaL JukkaL deleted the revert-lambda-fix branch December 9, 2021 17:14
@JukkaL
Copy link
Collaborator Author

JukkaL commented Dec 9, 2021

Also, I've seen some crashes which might be caused by this (not sure though).

I checked that the revert fixed this crash I was experiencing:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "mypy/checkexpr.py", line 3942, in accept
  File "mypy/nodes.py", line 2054, in accept
  File "mypy/checkexpr.py", line 3753, in visit_list_comprehension
  File "mypy/checkexpr.py", line 3780, in check_generator_or_comprehension
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "mypy/binder.py", line 402, in frame_context
AssertionError:

tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
…determine_type` (python#11215)" (python#11694)

This reverts commit d37c2be.

Lambdas can't be safely deferred. There are various subtle assumptions about
lambdas not being deferred in different parts of the codebase, and figuring out
how to do this safely is almost certainly not worth the trouble. This would be
very difficult to validate, since lambda deferral would probably happen very
rarely in practice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants