summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-01-18 08:26:16 (GMT)
committerLarry Hastings <larry@hastings.org>2014-01-18 08:26:16 (GMT)
commit4903e001418258ec9c72a849d6f8738aeecd8d69 (patch)
treea38958542135ba601aceea57d0c0e4dcd1ab2284 /Tools
parent3c16c1d821f307bca3a72f34c1a7dc2b56cb8eff (diff)
downloadcpython-4903e001418258ec9c72a849d6f8738aeecd8d69.zip
cpython-4903e001418258ec9c72a849d6f8738aeecd8d69.tar.gz
cpython-4903e001418258ec9c72a849d6f8738aeecd8d69.tar.bz2
Issue #20292: Small bug fix for Argument Clinic supporting format units
for strings with explicit encodings.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/clinic/clinic.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index c26d268..748f5cf 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -126,6 +126,10 @@ def quoted_for_c_string(s):
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 @@ class DSLParser:
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