[Python-checkins] gh-99677: Deduplicate self-type in `mro` in `inspect._getmembers` (#99678)

kumaraditya303 webhook-mailer at python.org
Sun Nov 27 06:15:31 EST 2022


https://github.com/python/cpython/commit/2653b82c1a44371ad0da6b5a1101abbda4acd2d3
commit: 2653b82c1a44371ad0da6b5a1101abbda4acd2d3
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com>
date: 2022-11-27T16:45:26+05:30
summary:

gh-99677: Deduplicate self-type in `mro` in `inspect._getmembers` (#99678)

Closes #99677

files:
M Lib/inspect.py

diff --git a/Lib/inspect.py b/Lib/inspect.py
index a896fcda31d1..31ac888126b5 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -537,7 +537,7 @@ def _getmembers(object, predicate, getter):
     processed = set()
     names = dir(object)
     if isclass(object):
-        mro = (object,) + getmro(object)
+        mro = getmro(object)
         # add any DynamicClassAttributes to the list of names if object is a class;
         # this may result in duplicate entries if, for example, a virtual
         # attribute with the same name as a DynamicClassAttribute exists



More information about the Python-checkins mailing list