[issue21117] inspect.signature: inaccuracies for partial functions

Yury Selivanov report at bugs.python.org
Wed Apr 2 23:08:52 CEST 2014


Yury Selivanov added the comment:

Please review the attached patch.

Here's the new partial signature semantics:

   foo(a, b, /, c, d, *args, e)

   partial(foo, 10) -> (b, /, c, d, *args, e)
   partial(foo, 10, c=11) -> (b, /, *, c=11, d, e)
   partial(foo, 10, 20, 30) -> (d, *args, e)
   partial(foo, 10, 20, 30, 40, 50) -> (*args, e)
   partial(foo, 10, 20, c=20) -> (*, c=20, d, e)

Good news: 

1. no more special attributes and other hidden hacks.

2. only with this patch we properly support functools.partial. So this is definitely something we can classify as a bug fix and push in 3.4.1.

----------
keywords: +patch
Added file: http://bugs.python.org/file34706/signature_partial_fix_01.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21117>
_______________________________________


More information about the Python-bugs-list mailing list