# HG changeset patch # User Paul Boddie # Date 1480107778 -3600 # Node ID 9957ac5894b40b5840e05dd3e0f5f144dca630a9 # Parent 2cd5f1e05cc945b19278e8749c91627713e9c144 Test for __args__ on callables when preparing generic invocations. Expanded the unbound methods tests to include error cases. diff -r 2cd5f1e05cc9 -r 9957ac5894b4 templates/progops.c --- a/templates/progops.c Fri Nov 25 21:55:37 2016 +0100 +++ b/templates/progops.c Fri Nov 25 22:02:58 2016 +0100 @@ -66,7 +66,7 @@ { /* Obtain the __args__ special member, referencing the parameter table. */ - __attr minparams = __load_via_object(callable.value, __pos___args__); + __attr minparams = __check_and_load_via_object(callable.value, __pos___args__, __code___args__); /* Refer to the table and minimum/maximum. */ diff -r 2cd5f1e05cc9 -r 9957ac5894b4 tests/methods_unbound.py --- a/tests/methods_unbound.py Fri Nov 25 21:55:37 2016 +0100 +++ b/tests/methods_unbound.py Fri Nov 25 22:02:58 2016 +0100 @@ -69,6 +69,7 @@ # Main program. c = C() +d = D() try: print f(C, 1) # fails @@ -100,3 +101,13 @@ print h(c, getd) # should fail with an error caused by a guard except TypeError: print "h(c, getd): getd provides an unsuitable result." + +try: + print h(d, 0)(4) # should fail with an error caused by a test +except TypeError: + print "h(d, 0): d is not a suitable argument." + +try: + print g(c, 1)(5) +except TypeError: + print "g(c, 1)(5): attempt to invoke an integer result from g."