]> granicus.if.org Git - python/commitdiff
Issue #20196: Fixed a bug where Argument Clinic did not generate correct
authorLarry Hastings <larry@hastings.org>
Sun, 12 Jan 2014 16:49:30 +0000 (08:49 -0800)
committerLarry Hastings <larry@hastings.org>
Sun, 12 Jan 2014 16:49:30 +0000 (08:49 -0800)
parsing code for functions with positional-only parameters where all arguments
are optional.

Misc/NEWS
Tools/clinic/clinic.py

index d73137eb40ac547323911eabda9015b540ab3397..d6be619d2f1c3312eeff7af6cf0c98e201b8db13 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -72,6 +72,10 @@ Tests
 Tools/Demos
 -----------
 
+- Issue #20196: Fixed a bug where Argument Clinic did not generate correct
+  parsing code for functions with positional-only parameters where all arguments
+  are optional.
+
 - Issue #18960: 2to3 and the findnocoding.py script now ignore the source
   encoding declaration on the second line if the first line contains anything
   except a comment.
index 421b9e3d39698e5cca3bc8a2b2dc3dcc844f2fd0..cd7c597f5335ccc11b3d8219375871a12ed3241c 100755 (executable)
@@ -591,6 +591,12 @@ static {impl_return_type}
             count_min = min(count_min, count)
             count_max = max(count_max, count)
 
+            if count == 0:
+                add("""    case 0:
+        break;
+""")
+                continue
+
             group_ids = {p.group for p in subset}  # eliminate duplicates
             d = {}
             d['count'] = count