gh-80282: Argument Clinic: Add clarifying comment about ASCII docstri… · python/cpython@925bbc2

Original file line numberDiff line numberDiff line change

@@ -5461,6 +5461,11 @@ def state_parameter_docstring_start(self, line: str) -> None:

54615461
54625462

def docstring_append(self, obj: Function | Parameter, line: str) -> None:

54635463

"""Add a rstripped line to the current docstring."""

5464+

# gh-80282: We filter out non-ASCII characters from the docstring,

5465+

# since historically, some compilers may balk on non-ASCII input.

5466+

# If you're using Argument Clinic in an external project,

5467+

# you may not need to support the same array of platforms as CPython,

5468+

# so you may be able to remove this restriction.

54645469

matches = re.finditer(r'[^\x00-\x7F]', line)

54655470

if offending := ", ".join([repr(m[0]) for m in matches]):

54665471

warn("Non-ascii characters are not allowed in docstrings:",