Skip to content

Commit

Permalink
Change default of Tablebase.max_fds to None
Browse files Browse the repository at this point in the history
This is compatible thanks to the new implementation, which does not keep
open file descriptors around in any case.
  • Loading branch information
niklasf committed Jan 7, 2023
1 parent 3fd1188 commit ebb7b39
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chess/syzygy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,12 +1482,8 @@ def setup_pieces_pawn_dtz(self, p_data: int, p_tb_size: int, f: int) -> None:
class Tablebase:
"""
Manages a collection of tablebase files for probing.
If *max_fds* is not ``None``, will at most use *max_fds* open file
descriptors at any given time. The least recently used tables are closed,
if necessary.
"""
def __init__(self, *, max_fds: Optional[int] = 128, VariantBoard: Type[chess.Board] = chess.Board) -> None:
def __init__(self, *, max_fds: Optional[int] = None, VariantBoard: Type[chess.Board] = chess.Board) -> None:
self.variant = VariantBoard

self.max_fds = max_fds
Expand Down Expand Up @@ -1967,7 +1963,7 @@ def __exit__(self, exc_type: Optional[Type[BaseException]], exc_value: Optional[
self.close()


def open_tablebase(directory: str, *, load_wdl: bool = True, load_dtz: bool = True, max_fds: Optional[int] = 128, VariantBoard: Type[chess.Board] = chess.Board) -> Tablebase:
def open_tablebase(directory: str, *, load_wdl: bool = True, load_dtz: bool = True, max_fds: Optional[int] = None, VariantBoard: Type[chess.Board] = chess.Board) -> Tablebase:
"""
Opens a collection of tables for probing. See
:class:`~chess.syzygy.Tablebase`.
Expand All @@ -1981,6 +1977,10 @@ def open_tablebase(directory: str, *, load_wdl: bool = True, load_dtz: bool = Tr
are often distributed separately, but are both required for 6-piece
positions. Use :func:`~chess.syzygy.Tablebase.add_directory()` to load
tables from additional directories.
:param max_fds: If *max_fds* is not ``None``, will at most use *max_fds*
open file descriptors at any given time. The least recently used tables
are closed, if necessary.
"""
tables = Tablebase(max_fds=max_fds, VariantBoard=VariantBoard)
tables.add_directory(directory, load_wdl=load_wdl, load_dtz=load_dtz)
Expand Down

0 comments on commit ebb7b39

Please sign in to comment.