Correct handling of functions with only kwarg args in getcallargs (closes #11256)

A patch from Daniel Urban.
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 33065f5..b0b2d3a 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -943,8 +943,14 @@
             f_name, 'at most' if defaults else 'exactly', num_args,
             'arguments' if num_args > 1 else 'argument', num_total))
     elif num_args == 0 and num_total:
-        raise TypeError('%s() takes no arguments (%d given)' %
-                        (f_name, num_total))
+        if varkw:
+            if num_pos:
+                # XXX: We should use num_pos, but Python also uses num_total:
+                raise TypeError('%s() takes exactly 0 arguments '
+                                '(%d given)' % (f_name, num_total))
+        else:
+            raise TypeError('%s() takes no arguments (%d given)' %
+                            (f_name, num_total))
     for arg in args:
         if isinstance(arg, str) and arg in named:
             if is_assigned(arg):