[Python-checkins] cpython: Issue #20196: Fixed a bug where Argument Clinic did not generate correct

larry.hastings python-checkins at python.org
Sun Jan 12 17:49:49 CET 2014


http://hg.python.org/cpython/rev/250b481a0d28
changeset:   88427:250b481a0d28
user:        Larry Hastings <larry at hastings.org>
date:        Sun Jan 12 08:49:30 2014 -0800
summary:
  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.

files:
  Misc/NEWS              |  4 ++++
  Tools/clinic/clinic.py |  6 ++++++
  2 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -72,6 +72,10 @@
 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.
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -591,6 +591,12 @@
             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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list