From 1eb869cf5a6bd6be2f8170ab721921137501ad53 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 8 Aug 2023 09:59:48 +0200 Subject: [PATCH 1/2] gh-80282: Argument Clinic: Add clarifying comment about ASCII docstring limitation --- Tools/clinic/clinic.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 82e5b804c2e3ea7..0b961d205688ab8 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -5459,6 +5459,11 @@ def state_parameter_docstring_start(self, line: str) -> None: 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. + # Also, Argument Clinic _may_ be used in external projects, with a + # different policy. Keep this in mind if you intend to remove this + # limitation. 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:", From 3bdfce23028b02c13d897433c5f1f001b37c17d2 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 8 Aug 2023 12:45:53 +0200 Subject: [PATCH 2/2] Update Tools/clinic/clinic.py Co-authored-by: Alex Waygood --- Tools/clinic/clinic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 0b961d205688ab8..4a7a70107fc19b5 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -5461,9 +5461,9 @@ 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. - # Also, Argument Clinic _may_ be used in external projects, with a - # different policy. Keep this in mind if you intend to remove this - # limitation. + # 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:",