Issue 15450: Allow dircmp.subdirs to behave well under subclassing (original) (raw)

Created on 2012-07-26 00:00 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue-15450-failing-test.patch chris.jerdonek,2012-07-26 19:32 review
issue-15450-1.patch chris.jerdonek,2012-07-26 19:41 review
issue-15450-2.patch chris.jerdonek,2012-07-27 23:01 review
Pull Requests
URL Status Linked Edit
PR 5088 closed mitar,2018-01-03 09:57
PR 23424 merged NickCrews,2020-11-20 17:40
Messages (7)
msg166443 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-07-26 00:00
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.
msg166503 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-07-26 19:32
Adding a patch with a failing test for the issue.
msg166505 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-07-26 19:41
Attaching full patch (though Misc/NEWS would need to be moved a new section is created for pre-alpha).
msg166507 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-07-26 19:44
Actually, this should also be documented.
msg166618 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-07-27 23:01
Updating patch to include documentation changes.
msg381490 - (view) Author: Nick Crews (NickCrews) * Date: 2020-11-20 17:42
I re-did this at https://github.com/python/cpython/pull/23424, let me know what you think. This is my first PR here, so I may have pooched something.
msg381677 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2020-11-23 16:30
New changeset 2f2f9d0b5c96e68ed91cddd6673860ee752eb49c by Nick Crews in branch 'master': bpo-15450: Allow subclassing of dircmp (GH-23424) (#23424) https://github.com/python/cpython/commit/2f2f9d0b5c96e68ed91cddd6673860ee752eb49c
History
Date User Action Args
2022-04-11 14:57:33 admin set github: 59655
2020-11-23 16:31:26 asvetlov set status: open -> closedstage: patch review -> resolvedresolution: fixedversions: + Python 3.10, - Python 3.4
2020-11-23 16:30:06 asvetlov set nosy: + asvetlovmessages: +
2020-11-20 17:42:10 NickCrews set messages: +
2020-11-20 17:40:40 NickCrews set nosy: + NickCrewspull_requests: + <pull%5Frequest22316>
2018-01-03 09:57:12 mitar set pull_requests: + <pull%5Frequest4962>
2018-01-03 09:43:27 mitar set nosy: + mitar
2012-12-27 10:59:55 hynek set nosy: + hynek
2012-10-17 18:42:48 petri.lehtinen set keywords: + patch
2012-07-31 18:28:33 chris.jerdonek set nosy: + cbc
2012-07-28 02:36:38 chris.jerdonek set nosy: + eli.bendersky
2012-07-27 23:01:13 chris.jerdonek set keywords: - patchfiles: + issue-15450-2.patchmessages: + stage: needs patch -> patch review
2012-07-26 19:44:10 chris.jerdonek set messages: + stage: patch review -> needs patch
2012-07-26 19:41:26 chris.jerdonek set stage: needs patch -> patch review
2012-07-26 19:41:19 chris.jerdonek set files: + issue-15450-1.patchmessages: +
2012-07-26 19:32:54 chris.jerdonek set files: + issue-15450-failing-test.patchkeywords: + patchmessages: + stage: needs patch
2012-07-26 00:00:03 chris.jerdonek create