summaryrefslogtreecommitdiff
path: root/Lib/profile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-06-05 18:22:31 +0300
committerGitHub <noreply@github.com>2019-06-05 18:22:31 +0300
commit142566c028720934325f0b7fe28680afd046e00f (patch)
tree021875972731bf9271bf07cc05d17f15866ded7a /Lib/profile.py
parent6c01ebcc0dfc6be22950fabb46bdc10dcb6202c9 (diff)
downloadcpython-git-142566c028720934325f0b7fe28680afd046e00f.tar.gz
[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/profile.py')
-rwxr-xr-xLib/profile.py18
1 files changed, 1 insertions, 17 deletions
diff --git a/Lib/profile.py b/Lib/profile.py
index 1346297c04..aad458dc95 100755
--- a/Lib/profile.py
+++ b/Lib/profile.py
@@ -425,29 +425,13 @@ class Profile:
return self
# This method is more useful to profile a single function call.
- def runcall(*args, **kw):
- if len(args) >= 2:
- self, func, *args = args
- elif not args:
- raise TypeError("descriptor 'runcall' of 'Profile' object "
- "needs an argument")
- elif 'func' in kw:
- func = kw.pop('func')
- self, *args = args
- import warnings
- warnings.warn("Passing 'func' as keyword argument is deprecated",
- DeprecationWarning, stacklevel=2)
- else:
- raise TypeError('runcall expected at least 1 positional argument, '
- 'got %d' % (len(args)-1))
-
+ def runcall(self, func, /, *args, **kw):
self.set_cmd(repr(func))
sys.setprofile(self.dispatcher)
try:
return func(*args, **kw)
finally:
sys.setprofile(None)
- runcall.__text_signature__ = '($self, func, /, *args, **kw)'
#******************************************************************