summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-08-09 05:55:34 (GMT)
committerGitHub <noreply@github.com>2023-08-09 05:55:34 (GMT)
commit925bbc2166d169962210314772d13270e9ba60a2 (patch)
treec701f1ec9aafdb84bb9a79b04f7d3d9f01df9820
parent7b6e34e5baeb4162815ffa4d943b09a58e3f6580 (diff)
downloadcpython-925bbc2166d169962210314772d13270e9ba60a2.zip
cpython-925bbc2166d169962210314772d13270e9ba60a2.tar.gz
cpython-925bbc2166d169962210314772d13270e9ba60a2.tar.bz2
gh-80282: Argument Clinic: Add clarifying comment about ASCII docstring limitation (#107764)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
-rwxr-xr-xTools/clinic/clinic.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 16f3171..059c2db 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -5461,6 +5461,11 @@ class DSLParser:
def docstring_append(self, obj: Function | Parameter, line: str) -> None:
"""Add a rstripped line to the current docstring."""
+ # gh-80282: We filter out non-ASCII characters from the docstring,
+ # since historically, some compilers may balk on non-ASCII input.
+ # If you're using Argument Clinic in an external project,
+ # you may not need to support the same array of platforms as CPython,
+ # so you may be able to remove this restriction.
matches = re.finditer(r'[^\x00-\x7F]', line)
if offending := ", ".join([repr(m[0]) for m in matches]):
warn("Non-ascii characters are not allowed in docstrings:",