[New-bugs-announce] [issue15450] Allow dircmp.subdirs to behave well under subclassing

Chris Jerdonek report at bugs.python.org
Thu Jul 26 02:00:03 CEST 2012

New submission from Chris Jerdonek <chris.jerdonek at gmail.com>:

Currently, the subdirs attribute of filecmp.dircmp does not respect subclassing:

>>> from filecmp import dircmp
>>> class MyDirCmp(dircmp):
...   pass
>>> my_dcmp = MyDirCmp('dir1', 'dir2')
>>> for item in my_dcmp.subdirs.values():
...   print(type(item))
...   break
<class 'filecmp.dircmp'>

This is the only place where dircmp does not respect subclassing.  It can be corrected here:

def phase4(self): # Find out differences between common subdirectories
        self.subdirs[x]  = dircmp(a_x, b_x, self.ignore, self.hide)

This would let one do things like override dircmp.report() and have dircmp.report_full_closure() behave as expected.

components: Library (Lib)
keywords: easy
messages: 166443
nosy: cjerdonek
priority: normal
severity: normal
status: open
title: Allow dircmp.subdirs to behave well under subclassing
type: enhancement
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list