[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
Turn deprecation warnings added in 3.8 into TypeError.
diff --git a/Lib/bdb.py b/Lib/bdb.py
index 96e7d18..fd34976 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -618,26 +618,11 @@
# This method is more useful to debug a single function call.
- def runcall(*args, **kwds):
+ def runcall(self, func, /, *args, **kwds):
"""Debug a single function call.
Return the result of the function call.
"""
- if len(args) >= 2:
- self, func, *args = args
- elif not args:
- raise TypeError("descriptor 'runcall' of 'Bdb' object "
- "needs an argument")
- elif 'func' in kwds:
- func = kwds.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))
-
self.reset()
sys.settrace(self.trace_dispatch)
res = None
@@ -649,7 +634,6 @@
self.quitting = True
sys.settrace(None)
return res
- runcall.__text_signature__ = '($self, func, /, *args, **kwds)'
def set_trace():