Skip to content

Commit a50f6e2

Browse files
committed
Fix _static.Dict.__ior__ for Python 3.8
1 parent b055895 commit a50f6e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

setuptools/_static.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ class Static:
2424
_mutated_: bool = False # TODO: Remove after deprecation warning is solved
2525

2626

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

3739
@wraps(fn)
3840
def _replacement(self: Static, *args, **kwargs):

0 commit comments

Comments
 (0)