[Python-checkins] cpython: Issue #20292: Small bug fix for Argument Clinic supporting format units

larry.hastings python-checkins at python.org
Sat Jan 18 09:26:47 CET 2014


http://hg.python.org/cpython/rev/949acdd43b45
changeset:   88540:949acdd43b45
user:        Larry Hastings <larry at hastings.org>
date:        Sat Jan 18 00:26:16 2014 -0800
summary:
  Issue #20292: Small bug fix for Argument Clinic supporting format units
for strings with explicit encodings.

files:
  Tools/clinic/clinic.py |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -126,6 +126,10 @@
         s = s.replace(old, new)
     return s
 
+def c_repr(s):
+    return '"' + s + '"'
+
+
 is_legal_c_identifier = re.compile('^[A-Za-z_][A-Za-z0-9_]*$').match
 
 def is_legal_py_identifier(s):
@@ -3129,7 +3133,7 @@
                     if isinstance(value, (bool, None.__class__)):
                         c_default = "Py_" + py_default
                     elif isinstance(value, str):
-                        c_default = '"' + quoted_for_c_string(value) + '"'
+                        c_default = c_repr(value)
                     else:
                         c_default = py_default
 

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


More information about the Python-checkins mailing list