Skip to content

Commit

Permalink
fixup! Drop support for Python 3.7 (niklasf#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Jul 27, 2023
1 parent 8581612 commit 8b9e148
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion chess/polyglot.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ def size(self) -> int:
def close(self) -> None:
pass

def madvise(self, option: int, start: int = ..., length: int = ...) -> None:
pass


def _randint(rng: Optional[random.Random], a: int, b: int) -> int:
return random.randint(a, b) if rng is None else rng.randint(a, b)
Expand All @@ -333,7 +336,7 @@ def __init__(self, filename: PathLike) -> None:
raise IOError(f"invalid file size: ensure {filename!r} is a valid polyglot opening book")

try:
# Linux
# Unix
self.mmap.madvise(mmap.MADV_RANDOM)
except AttributeError:
pass
Expand Down
2 changes: 1 addition & 1 deletion chess/syzygy.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def init_mmap(self) -> None:
raise IOError(f"invalid file size: ensure {self.path!r} is a valid syzygy tablebase file")

try:
# Linux
# Unix
data.madvise(mmap.MADV_RANDOM)
except AttributeError:
pass
Expand Down

0 comments on commit 8b9e148

Please sign in to comment.