Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
kwist-sgr committed Jun 19, 2024
commit 3fd40fa165e943ebbbadbcef1aea74229e7ea0e1
4 changes: 3 additions & 1 deletion src/filelock/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __call__( # noqa: PLR0913
raise ValueError(msg)

# Workaround to make `__init__`'s params optional in subclasses
# E.g. virtualenv changes the `__init__` signature of the `BaseFileLock` class
# E.g. virtualenv changes the signature of the `__init__` method in the `BaseFileLock` class descendant
# (https://github.com/tox-dev/filelock/pull/340)

all_params = {
Expand All @@ -131,6 +131,8 @@ def __call__( # noqa: PLR0913

present_params = set(inspect.signature(cls.__init__).parameters)
init_params = {key: value for key, value in all_params.items() if key in present_params}
# The `lock_file` parameter is required
init_params["lock_file"] = lock_file

instance = super().__call__(**init_params)

Expand Down