1.1 --- a/templates/ops.c Thu Mar 23 23:36:32 2017 +0100
1.2 +++ b/templates/ops.c Fri Mar 24 19:07:01 2017 +0100
1.3 @@ -326,8 +326,11 @@
1.4
1.5 __attr (*__get_function(__attr context, __attr target))(__attr[])
1.6 {
1.7 - target = __unwrap_callable(target);
1.8 + return __get_function_unwrapped(context, __unwrap_callable(target));
1.9 +}
1.10
1.11 +__attr (*__get_function_unwrapped(__attr context, __attr target))(__attr[])
1.12 +{
1.13 /* Require null or instance contexts for functions and methods respectively,
1.14 or type instance contexts for type methods. */
1.15
1.16 @@ -339,8 +342,11 @@
1.17
1.18 __attr (*__check_and_get_function(__attr context, __attr target))(__attr[])
1.19 {
1.20 - target = __unwrap_callable(target);
1.21 + return __check_and_get_function_unwrapped(context, __unwrap_callable(target));
1.22 +}
1.23
1.24 +__attr (*__check_and_get_function_unwrapped(__attr context, __attr target))(__attr[])
1.25 +{
1.26 /* Require null or instance contexts for functions and methods respectively,
1.27 or type instance contexts for type methods. */
1.28
2.1 --- a/templates/ops.h Thu Mar 23 23:36:32 2017 +0100
2.2 +++ b/templates/ops.h Fri Mar 24 19:07:01 2017 +0100
2.3 @@ -114,7 +114,9 @@
2.4 __attr __unwrap_callable(__attr callable);
2.5 __attr (*__get_function_unchecked(__attr target))(__attr[]);
2.6 __attr (*__get_function(__attr context, __attr target))(__attr[]);
2.7 +__attr (*__get_function_unwrapped(__attr context, __attr target))(__attr[]);
2.8 __attr (*__check_and_get_function(__attr context, __attr target))(__attr[]);
2.9 +__attr (*__check_and_get_function_unwrapped(__attr context, __attr target))(__attr[]);
2.10
2.11 /* Parameter position operations. */
2.12
3.1 --- a/templates/progops.c Thu Mar 23 23:36:32 2017 +0100
3.2 +++ b/templates/progops.c Fri Mar 24 19:07:01 2017 +0100
3.3 @@ -204,14 +204,22 @@
3.4 unsigned int pos, kwpos;
3.5
3.6 /* Check the number of arguments. */
3.7 +
3.8 + if ((nargs == max) && (nkwargs == 0))
3.9 + {
3.10 + /* pass */
3.11 + }
3.12 +
3.13 /* NOTE: Should use a more specific exception. */
3.14
3.15 - if ((min > (nargs + nkwargs)) || ((nargs + nkwargs) > max))
3.16 + else if ((min > (nargs + nkwargs)) || ((nargs + nkwargs) > max))
3.17 + {
3.18 __raise_type_error();
3.19 + }
3.20
3.21 /* Copy the arguments. */
3.22
3.23 - if (nargs < max)
3.24 + else if (nargs < max)
3.25 {
3.26 allargs = moreargs;
3.27
3.28 @@ -253,7 +261,10 @@
3.29
3.30 /* Call with the prepared arguments. */
3.31
3.32 - return (always_callable ? __get_function(allargs[0], target) : __check_and_get_function(allargs[0], target))(allargs);
3.33 + return (always_callable ?
3.34 + __get_function_unwrapped(allargs[0], target) :
3.35 + __check_and_get_function_unwrapped(allargs[0], target)
3.36 + )(allargs);
3.37 }
3.38
3.39 /* Error routines. */