summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-03-06 18:23:48 (GMT)
committerGitHub <noreply@github.com>2018-03-06 18:23:48 (GMT)
commit112f799666bac1bdbb320840d5fda3132255eb5e (patch)
tree77b80d306834ea2ce3ed21f8ee09f7d7152c9164 /Lib/inspect.py
parent5a0c3987abd6a71b4fadeb525477eb5f560e8514 (diff)
downloadcpython-112f799666bac1bdbb320840d5fda3132255eb5e.zip
cpython-112f799666bac1bdbb320840d5fda3132255eb5e.tar.gz
cpython-112f799666bac1bdbb320840d5fda3132255eb5e.tar.bz2
bpo-33009: Fix inspect.signature() for single-parameter partialmethods. (GH-6004)
(cherry picked from commit 8a387219bdfb6ee34928d6168ac42ca559f11c9a) Co-authored-by: Yury Selivanov <yury@magic.io>
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index d629689..f271992 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -2254,7 +2254,8 @@ def _signature_from_callable(obj, *,
return sig
else:
sig_params = tuple(sig.parameters.values())
- assert first_wrapped_param is not sig_params[0]
+ assert (not sig_params or
+ first_wrapped_param is not sig_params[0])
new_params = (first_wrapped_param,) + sig_params
return sig.replace(parameters=new_params)