Skip to content

Commit f0fac6d

Browse files
committed
refactor
1 parent 9b54ab1 commit f0fac6d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

mypy/checker.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,9 @@ def accept_loop(
595595

596596
# Disable error types that we cannot safely identify in intermediate iteration steps:
597597
warn_unreachable = self.options.warn_unreachable
598-
if warn_unreachable:
599-
self.options.warn_unreachable = False
600598
warn_redundant = codes.REDUNDANT_EXPR in self.options.enabled_error_codes
601-
if warn_redundant:
602-
self.options.enabled_error_codes.remove(codes.REDUNDANT_EXPR)
599+
self.options.warn_unreachable = False
600+
self.options.enabled_error_codes.discard(codes.REDUNDANT_EXPR)
603601

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

612610
# If necessary, reset the modified options and make up for the postponed error checks:
611+
self.options.warn_unreachable = warn_unreachable
612+
if warn_redundant:
613+
self.options.enabled_error_codes.add(codes.REDUNDANT_EXPR)
613614
if warn_unreachable or warn_redundant:
614-
self.options.warn_unreachable = warn_unreachable
615-
if warn_redundant:
616-
self.options.enabled_error_codes.add(codes.REDUNDANT_EXPR)
617615
with self.binder.frame_context(can_skip=True, break_frame=2, continue_frame=1):
618616
self.accept(body)
619617

0 commit comments

Comments
 (0)