Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b539cef3
Commit
b539cef3
authored
Dec 31, 2018
by
Sanyam Khurana
Committed by
Nick Coghlan
Dec 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35614: Fix pydoc help() on metaclasses (#11357)
parent
1d300ce1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
Lib/pydoc.py
Lib/pydoc.py
+1
-1
Lib/test/test_pydoc.py
Lib/test/test_pydoc.py
+11
-0
Misc/NEWS.d/next/Library/2018-12-30-01-10-50.bpo-35614.cnkM4f.rst
...S.d/next/Library/2018-12-30-01-10-50.bpo-35614.cnkM4f.rst
+1
-0
No files found.
Lib/pydoc.py
View file @
b539cef3
...
...
@@ -1255,7 +1255,7 @@ location listed above.
# List the built-in subclasses, if any:
subclasses
=
sorted
(
(
str
(
cls
.
__name__
)
for
cls
in
object
.
__subclasses__
(
)
(
str
(
cls
.
__name__
)
for
cls
in
type
.
__subclasses__
(
object
)
if
not
cls
.
__name__
.
startswith
(
"_"
)
and
cls
.
__module__
==
"builtins"
),
key
=
str
.
lower
)
...
...
Lib/test/test_pydoc.py
View file @
b539cef3
...
...
@@ -636,6 +636,17 @@ class PydocDocTest(unittest.TestCase):
# Testing that the subclasses section does not appear
self
.
assertNotIn
(
'Built-in subclasses'
,
text
)
def
test_builtin_on_metaclasses
(
self
):
"""Tests help on metaclasses.
When running help() on a metaclasses such as type, it
should not contain any "Built-in subclasses" section.
"""
doc
=
pydoc
.
TextDoc
()
text
=
doc
.
docclass
(
type
)
# Testing that the subclasses section does not appear
self
.
assertNotIn
(
'Built-in subclasses'
,
text
)
@
unittest
.
skipIf
(
sys
.
flags
.
optimize
>=
2
,
'Docstrings are omitted with -O2 and above'
)
@
unittest
.
skipIf
(
hasattr
(
sys
,
'gettrace'
)
and
sys
.
gettrace
(),
...
...
Misc/NEWS.d/next/Library/2018-12-30-01-10-50.bpo-35614.cnkM4f.rst
0 → 100644
View file @
b539cef3
Fixed help() on metaclasses. Patch by Sanyam Khurana.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment