Mocking only works if sys.modules['pydoc'] and pydoc are the same,
but some pydoc functions reload the module and change sys.modules.
Ensure that sys.modules['pydoc'] is always restored after the corresponding
tests.
(cherry picked from commit 2cf47389e2)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
(cherry picked from commit 31d1d72d7e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
If the Helper() class was initialized with an output, the topics, keywords
and symbols help still use the pager instead of the output.
Change the behavior so the output is used if available while keeping the
previous behavior if no output was configured.
(cherry picked from commit 2080425154)
Co-authored-by: Enrico Tröger <enrico.troeger@uvena.de>