diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-03-06 10:48:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-06 10:48:04 -0800 |
commit | 387a055261267f5fafd2c12eafef49759c94704f (patch) | |
tree | 20f5036888d149aa867dd0406d89aa993111a823 /Lib/inspect.py | |
parent | [3.6] bpo-33001: Prevent buffer overrun in os.symlink (GH-5989) (GH-5990) (diff) | |
download | cpython-387a055261267f5fafd2c12eafef49759c94704f.tar.gz cpython-387a055261267f5fafd2c12eafef49759c94704f.tar.bz2 cpython-387a055261267f5fafd2c12eafef49759c94704f.zip |
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.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index e9c2dbd5c88..dc2aab2826a 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2251,7 +2251,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) |