summaryrefslogtreecommitdiffstats
path: root/Tools/clinic
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-08-08 06:41:09 (GMT)
committerGitHub <noreply@github.com>2023-08-08 06:41:09 (GMT)
commit0db043dd5a34f7b5968476011e36396737d09030 (patch)
tree69f2f7db677cf3983152e14979d468b29fb302af /Tools/clinic
parent328d925244511b2134d5ac926e307e4486ff4500 (diff)
downloadcpython-0db043dd5a34f7b5968476011e36396737d09030.zip
cpython-0db043dd5a34f7b5968476011e36396737d09030.tar.gz
cpython-0db043dd5a34f7b5968476011e36396737d09030.tar.bz2
gh-95065: Make Argument Clinic append deprecation warnings to docstrings (#107745)
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-xTools/clinic/clinic.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 57ad4e4..82e5b80 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -941,6 +941,12 @@ class CLanguage(Language):
f"{func.full_name}() is deprecated. Parameters {pstr} will "
f"become keyword-only parameters in Python {major}.{minor}."
)
+
+ # Append deprecation warning to docstring.
+ lines = textwrap.wrap(f"Note: {depr_message}")
+ docstring = "\n".join(lines)
+ func.docstring += f"\n\n{docstring}\n"
+
# Format and return the code block.
code = self.DEPRECATED_POSITIONAL_PROTOTYPE.format(
condition=condition,