Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitc95c93d

Browse files
authored
bpo-20285: Improve help docs for object (GH-4759)
1 parentf1e17e9 commitc95c93d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

‎Lib/pydoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ def spilldata(msg, attrs, predicate):
867867
thisclass=attrs[0][2]
868868
attrs,inherited=_split_list(attrs,lambdat:t[2]isthisclass)
869869

870-
ifthisclassisbuiltins.object:
870+
ifobjectisnotbuiltins.objectandthisclassisbuiltins.object:
871871
attrs=inherited
872872
continue
873873
elifthisclassisobject:
@@ -1327,7 +1327,7 @@ def spilldata(msg, attrs, predicate):
13271327
thisclass=attrs[0][2]
13281328
attrs,inherited=_split_list(attrs,lambdat:t[2]isthisclass)
13291329

1330-
ifthisclassisbuiltins.object:
1330+
ifobjectisnotbuiltins.objectandthisclassisbuiltins.object:
13311331
attrs=inherited
13321332
continue
13331333
elifthisclassisobject:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Expand object.__doc__ (docstring) to make it clearer.
2+
Modify pydoc.py so that help(object) lists object methods
3+
(for other classes, help omits methods of the object base class.)

‎Objects/typeobject.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4750,6 +4750,11 @@ static PyMethodDef object_methods[] = {
47504750
{0}
47514751
};
47524752

4753+
PyDoc_STRVAR(object_doc,
4754+
"object()\n--\n\n"
4755+
"The base class of the class hierarchy.\n\n"
4756+
"When called, it accepts no arguments and returns a new featureless\n"
4757+
"instance that has no instance attributes and cannot be given any.\n");
47534758

47544759
PyTypeObjectPyBaseObject_Type= {
47554760
PyVarObject_HEAD_INIT(&PyType_Type,0)
@@ -4772,7 +4777,7 @@ PyTypeObject PyBaseObject_Type = {
47724777
PyObject_GenericSetAttr,/* tp_setattro */
47734778
0,/* tp_as_buffer */
47744779
Py_TPFLAGS_DEFAULT |Py_TPFLAGS_BASETYPE,/* tp_flags */
4775-
PyDoc_STR("object()\n--\n\nThe most base type"),/* tp_doc */
4780+
object_doc,/* tp_doc */
47764781
0,/* tp_traverse */
47774782
0,/* tp_clear */
47784783
object_richcompare,/* tp_richcompare */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp