diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-06-05 15:22:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-05 15:22:31 (GMT) |
commit | 142566c028720934325f0b7fe28680afd046e00f (patch) | |
tree | 021875972731bf9271bf07cc05d17f15866ded7a /Lib/functools.py | |
parent | 6c01ebcc0dfc6be22950fabb46bdc10dcb6202c9 (diff) | |
download | cpython-142566c028720934325f0b7fe28680afd046e00f.zip cpython-142566c028720934325f0b7fe28680afd046e00f.tar.gz cpython-142566c028720934325f0b7fe28680afd046e00f.tar.bz2 |
[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
Turn deprecation warnings added in 3.8 into TypeError.
Diffstat (limited to 'Lib/functools.py')
-rw-r--r-- | Lib/functools.py | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/Lib/functools.py b/Lib/functools.py index 64d1201..9495fbe 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -345,23 +345,7 @@ class partialmethod(object): callables as instance methods. """ - def __init__(*args, **keywords): - if len(args) >= 2: - self, func, *args = args - elif not args: - raise TypeError("descriptor '__init__' of partialmethod " - "needs an argument") - elif 'func' in keywords: - func = keywords.pop('func') - self, *args = args - import warnings - warnings.warn("Passing 'func' as keyword argument is deprecated", - DeprecationWarning, stacklevel=2) - else: - raise TypeError("type 'partialmethod' takes at least one argument, " - "got %d" % (len(args)-1)) - args = tuple(args) - + def __init__(self, func, /, *args, **keywords): if not callable(func) and not hasattr(func, "__get__"): raise TypeError("{!r} is not callable or a descriptor" .format(func)) @@ -379,7 +363,6 @@ class partialmethod(object): self.func = func self.args = args self.keywords = keywords - __init__.__text_signature__ = '($self, func, /, *args, **keywords)' def __repr__(self): args = ", ".join(map(repr, self.args)) |