Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-40257: Output object's own docstring in pydoc #19479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add docs.
  • Loading branch information
serhiy-storchaka committed Apr 15, 2020
commit 99048a3a1ea50a5491f96ec2e1d533f37efb49a1
5 changes: 4 additions & 1 deletion 5 Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,15 @@ Retrieving source code

Get the documentation string for an object, cleaned up with :func:`cleandoc`.
If the documentation string for an object is not provided and the object is
a class, a method, a property or a descriptor, retrieve the documentation
a method, a property or a descriptor, retrieve the documentation
string from the inheritance hierarchy.

.. versionchanged:: 3.5
Documentation strings are now inherited if not overridden.

.. versionchanged:: 3.9
Documentation strings for classes are no longer inherited.


.. function:: getcomments(object)

Expand Down
13 changes: 13 additions & 0 deletions 13 Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ pprint
:mod:`pprint` can now pretty-print :class:`types.SimpleNamespace`.
(Contributed by Carl Bordum Hansen in :issue:`37376`.)

pydoc
-----

The documentation string is now shown not only for class, function,
method etc, but for any object that has its own ``__doc__`` attribute.
(Contributed by Serhiy Storchaka in :issue:`40257`.)

signal
------

Expand Down Expand Up @@ -798,6 +805,12 @@ Changes in the Python API
:class:`ftplib.FTP_TLS` as a keyword-only parameter, and the default encoding
is changed from Latin-1 to UTF-8 to follow :rfc:`2640`.

* :func:`inspect.getdoc` no longer returns docstring inherited from the type
of the object or from parent class if it is a class if it is not defined
in the object itself.
(Contributed by Serhiy Storchaka in :issue:`40257`.)


CPython bytecode changes
------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
func:`inspect.getdoc` no longer returns docstring inherited from the type of
the object or from parent class if it is a class if it is not defined in the
object itself. In :mod:`pydoc` the documentation string is now shown not
only for class, function, method etc, but for any object that has its own
``__doc__`` attribute.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.