-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow dircmp.subdirs to behave well under subclassing #59655
Comments
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. |
Adding a patch with a failing test for the issue. |
Attaching full patch (though Misc/NEWS would need to be moved a new section is created for pre-alpha). |
Actually, this should also be documented. |
Updating patch to include documentation changes. |
I re-did this at #23424, let me know what you think. This is my first PR here, so I may have pooched something. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: