Skip to content

Commit

Permalink
Type Base.__iter__ as NoReturn
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmot committed Dec 8, 2023
1 parent b6eeafc commit 58abb35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions claripy/ast/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import weakref
from collections import OrderedDict, deque
from itertools import chain
from typing import Optional, Generic, TypeVar, overload, TYPE_CHECKING, List, Iterable, Iterator, Tuple
from typing import Optional, Generic, TypeVar, overload, TYPE_CHECKING, List, Iterable, Iterator, Tuple, NoReturn

if TYPE_CHECKING:
from .bool import Bool
Expand Down Expand Up @@ -908,13 +908,13 @@ def split(self, split_on: Iterable[str]) -> List:
return [self]

# we don't support iterating over Base objects
def __iter__(self):
def __iter__(self) -> NoReturn:
"""
This prevents people from iterating over ASTs.
"""
raise ClaripyOperationError("Please don't iterate over, or split, AST nodes!")

def __bool__(self):
def __bool__(self) -> NoReturn:
"""
This prevents people from accidentally using an AST as a condition. For
example, the following was previously common::
Expand Down

0 comments on commit 58abb35

Please sign in to comment.