Issue #7830: Flatten nested functools.partial.
diff --git a/Lib/functools.py b/Lib/functools.py
index 20a26f9..91e9685 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -241,6 +241,14 @@
"""New function with partial application of the given arguments
and keywords.
"""
+ if hasattr(func, 'func'):
+ args = func.args + args
+ tmpkw = func.keywords.copy()
+ tmpkw.update(keywords)
+ keywords = tmpkw
+ del tmpkw
+ func = func.func
+
def newfunc(*fargs, **fkeywords):
newkeywords = keywords.copy()
newkeywords.update(fkeywords)