Skip to content

Commit

Permalink
Fix _static.Dict.__ior__ for Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 20, 2024
1 parent e6b718a commit 38d6b05
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions setuptools/_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ class Static:
_mutated_: bool = False # TODO: Remove after deprecation warning is solved


def _prevent_modification(target: type, method: str, copying: str):
def _prevent_modification(target: type, method: str, copying: str) -> None:
"""
Because setuptools is very flexible we cannot fully prevent
plugins and user customisations from modifying static values that were
parsed from config files.
But we can attempt to block "in-place" mutations and identify when they
were done.
"""
fn = getattr(target, method)
fn = getattr(target, method, None)
if fn is None:
return

@wraps(fn)
def _replacement(self: Static, *args, **kwargs):
Expand Down

0 comments on commit 38d6b05

Please sign in to comment.