Skip to content

Commit c6e7fe9

Browse files
committed
bpo-20285: Improve help docs for object
1 parent 62ed6be commit c6e7fe9

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Lib/pydoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ def spilldata(msg, attrs, predicate):
873873
thisclass = attrs[0][2]
874874
attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass)
875875

876-
if thisclass is builtins.object:
876+
if object is not builtins.object and thisclass is builtins.object:
877877
attrs = inherited
878878
continue
879879
elif thisclass is object:
@@ -1319,7 +1319,7 @@ def spilldata(msg, attrs, predicate):
13191319
thisclass = attrs[0][2]
13201320
attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass)
13211321

1322-
if thisclass is builtins.object:
1322+
if object is not builtins.object and thisclass is builtins.object:
13231323
attrs = inherited
13241324
continue
13251325
elif thisclass is object:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve object.__doc__ and help(object) output.

Objects/typeobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4703,6 +4703,8 @@ static PyMethodDef object_methods[] = {
47034703
{0}
47044704
};
47054705

4706+
PyDoc_STRVAR(object_doc,
4707+
"object()\n--\n\nThe superclass for all Python classes.");
47064708

47074709
PyTypeObject PyBaseObject_Type = {
47084710
PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -4725,7 +4727,7 @@ PyTypeObject PyBaseObject_Type = {
47254727
PyObject_GenericSetAttr, /* tp_setattro */
47264728
0, /* tp_as_buffer */
47274729
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
4728-
PyDoc_STR("object()\n--\n\nThe most base type"), /* tp_doc */
4730+
object_doc, /* tp_doc */
47294731
0, /* tp_traverse */
47304732
0, /* tp_clear */
47314733
object_richcompare, /* tp_richcompare */

0 commit comments

Comments
 (0)