bpo-20285: Improve help docs for object by csabella · Pull Request #4759 · python/cpython

One confusing thing about this module is that the argument that the docs are being created for is named is object. So, for this PR, object both can refer to the name of the argument and the class called object.

thisclass is the third value (index 2) in the sequence returned from inspect.classify_class_attrs(object), which is defined as "The class which defined this attribute" (from the docstring). When the value of the class is object, the current if statement if thisclass is builtins.object: results in that attribute being skipped from the output.

The change is to skip the logic when the argument value is not builtins.object so that the attributes will be displayed when help(object) is used. Without this change, all of the attributes are skipped because "The class which defined this attribute" is always object.