@@ -707,9 +707,10 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
707707Retrieving source code
708708----------------------
709709
710- .. function :: getdoc(object, *, inherit_class_doc=True, fallback_to_class_doc=True)
710+ .. function :: getdoc(object, *, inherit_class_doc=True, fallback_to_class_doc=True, dedent=True )
711711
712- Get the documentation string for an object, cleaned up with :func: `cleandoc `.
712+ Get the documentation string for an object, cleaned up with :func: `cleandoc `
713+ (with the same meaning of *dedent *).
713714 If the documentation string for an object is not provided:
714715
715716 * if the object is a class and *inherit_class_doc * is true (by default),
@@ -730,6 +731,9 @@ Retrieving source code
730731 Documentation strings on :class: `~functools.cached_property `
731732 objects are now inherited if not overridden.
732733
734+ .. versionchanged :: next
735+ Added the *dedent * parameter.
736+
733737
734738.. function :: getcomments(object)
735739
@@ -791,15 +795,23 @@ Retrieving source code
791795 former.
792796
793797
794- .. function :: cleandoc(doc)
798+ .. function :: cleandoc(doc, *, dedent=True )
795799
796800 Clean up indentation from docstrings that are indented to line up with blocks
797801 of code.
798802
799803 All leading whitespace is removed from the first line. Any leading whitespace
800- that can be uniformly removed from the second line onwards is removed. Empty
801- lines at the beginning and end are subsequently removed. Also, all tabs are
802- expanded to spaces.
804+ that can be uniformly removed from the second line onwards is removed, unless
805+ *dedent * is false. Empty lines at the beginning and end are subsequently
806+ removed. Also, all tabs are expanded to spaces.
807+
808+ Since Python 3.13 the compiler removes the indentation of docstrings, so
809+ *dedent * only affects documentation strings which are not written as
810+ docstrings in the source code, like those generated by Argument Clinic,
811+ where the indentation is meaningful.
812+
813+ .. versionchanged :: next
814+ Added the *dedent * parameter.
803815
804816
805817.. _inspect-signature-object :
0 commit comments