This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove duplicates from a result of getclasstree()
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: eric.araujo, ezio.melotti, georg.brandl, python-dev, serhiy.storchaka, vajrasky
Priority: normal Keywords: needs review, patch

Created on 2013-08-25 14:50 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getclasstree_no_dups.patch serhiy.storchaka, 2013-08-25 14:50 review
getclasstree_no_dups_2.patch serhiy.storchaka, 2013-08-29 10:09 review
Messages (5)
msg196138 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-25 14:50
inspect.getclasstree() produces duplicated entities when it's argument contains duplicated classes. This happened when a module contains class aliases. For example `pydoc zipfile` outputs three entities for BadZipFile (BadZipfile and error are aliases of BadZipFile):

CLASSES
    builtins.Exception(builtins.BaseException)
        BadZipFile
        BadZipFile
        BadZipFile
        LargeZipFile
    builtins.object
        ZipFile
            PyZipFile
        ZipInfo
    
The proposed patch removes duplicates from a result of getclasstree().
msg196218 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-08-26 15:54
+1
msg196308 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-08-27 18:39
What about if you extend the test coverage as well? Right now, we don't have test to test getclasstree method with unique parameter set to false.
msg196453 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-29 10:09
Here is a patch with additional test.
msg197001 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-05 14:37
New changeset 39d0dfa5808c by Serhiy Storchaka in branch '3.3':
Issue #18830: inspect.getclasstree() no more produces duplicated entries even
http://hg.python.org/cpython/rev/39d0dfa5808c

New changeset 86ab7b7c173e by Serhiy Storchaka in branch 'default':
Issue #18830: inspect.getclasstree() no more produces duplicated entries even
http://hg.python.org/cpython/rev/86ab7b7c173e

New changeset 408165aced01 by Serhiy Storchaka in branch '2.7':
Issue #18830: inspect.getclasstree() no more produces duplicated entries even
http://hg.python.org/cpython/rev/408165aced01
History
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63030
2013-09-05 14:39:54serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-09-05 14:37:48python-devsetnosy: + python-dev
messages: + msg197001
2013-08-29 10:09:24serhiy.storchakasetfiles: + getclasstree_no_dups_2.patch

messages: + msg196453
2013-08-27 18:39:33vajraskysetnosy: + vajrasky
messages: + msg196308
2013-08-27 17:43:22serhiy.storchakasetkeywords: + needs review
assignee: serhiy.storchaka
2013-08-26 17:50:10serhiy.storchakasetversions: - Python 3.2
2013-08-26 15:54:00eric.araujosetmessages: + msg196218
versions: + Python 3.4
2013-08-25 14:50:13serhiy.storchakacreate