Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tyralla committed Jan 12, 2025
1 parent 9b54ab1 commit f0fac6d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,9 @@ def accept_loop(

# Disable error types that we cannot safely identify in intermediate iteration steps:
warn_unreachable = self.options.warn_unreachable
if warn_unreachable:
self.options.warn_unreachable = False
warn_redundant = codes.REDUNDANT_EXPR in self.options.enabled_error_codes
if warn_redundant:
self.options.enabled_error_codes.remove(codes.REDUNDANT_EXPR)
self.options.warn_unreachable = False
self.options.enabled_error_codes.discard(codes.REDUNDANT_EXPR)

while True:
with self.binder.frame_context(can_skip=True, break_frame=2, continue_frame=1):
Expand All @@ -610,10 +608,10 @@ def accept_loop(
partials_old = partials_new

# If necessary, reset the modified options and make up for the postponed error checks:
self.options.warn_unreachable = warn_unreachable
if warn_redundant:
self.options.enabled_error_codes.add(codes.REDUNDANT_EXPR)
if warn_unreachable or warn_redundant:
self.options.warn_unreachable = warn_unreachable
if warn_redundant:
self.options.enabled_error_codes.add(codes.REDUNDANT_EXPR)
with self.binder.frame_context(can_skip=True, break_frame=2, continue_frame=1):
self.accept(body)

Expand Down

0 comments on commit f0fac6d

Please sign in to comment.