diff options
author | Erlend E. Aasland <erlend@python.org> | 2023-08-08 06:41:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 06:41:09 (GMT) |
commit | 0db043dd5a34f7b5968476011e36396737d09030 (patch) | |
tree | 69f2f7db677cf3983152e14979d468b29fb302af /Tools/clinic | |
parent | 328d925244511b2134d5ac926e307e4486ff4500 (diff) | |
download | cpython-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-x | Tools/clinic/clinic.py | 6 |
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, |