Skip to content

Commit 587937c

Browse files
committed
Remove context manager from analyze_cond_branch call
1 parent db29355 commit 587937c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

mypy/checkexpr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,9 +2807,9 @@ def check_boolean_op(self, e: OpExpr, context: Context) -> Type:
28072807

28082808
if right_map is None:
28092809
with self.msg.disable_errors():
2810-
right_type = self.analyze_cond_branch(right_map, e.right, left_type)
2810+
right_type = self.analyze_cond_branch(None, e.right, left_type)
28112811
else:
2812-
right_type = self.analyze_cond_branch(right_map, e.right, left_type)
2812+
right_type = self.analyze_cond_branch(right_map, e.right, left_type)
28132813

28142814
if right_map is None:
28152815
# The boolean expression is statically known to be the left value

mypy/messages.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ def add_errors(self, messages: 'MessageBuilder') -> None:
137137
for info in errs:
138138
self.errors.add_error_info(info)
139139

140+
def disable_errors1(self) -> None:
141+
self.disable_count += 1
142+
140143
@contextmanager
141144
def disable_errors(self) -> Iterator[None]:
142145
self.disable_count += 1
@@ -145,6 +148,9 @@ def disable_errors(self) -> Iterator[None]:
145148
finally:
146149
self.disable_count -= 1
147150

151+
def enable_errors(self) -> None:
152+
self.disable_count -= 1
153+
148154
def is_errors(self) -> bool:
149155
return self.errors.is_errors()
150156

0 commit comments

Comments
 (0)