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:
assignee=Noneclosed_at=Nonecreated_at=<Date2011-09-07.16:01:35.750>labels= ['type-feature', 'library']
title='filecmp.dircmp does not allow non-shallow comparisons'updated_at=<Date2018-01-03.09:42:28.161>user='https://bugs.python.org/kesmit'
While filecmp.cmp and filecmp.cmpfiles allow a shallow option to be specified to invoke a more involved comparison of files, filecmp.dircmp does not. It is limited to shallow-only comparisons.
This could be solved quite easily by adding a shallow keyword option to dircmp then changing the phase3 method to the following.
defphase3(self): # Find out differences between common filesxx=cmpfiles(self.left, self.right, self.common_files, self.shallow)
self.same_files, self.diff_files, self.funny_files=xx
Whether or not this feature is implemented, I think the documentation should state that directory comparisons are done using "shallow=True". I created bpo-15250 for this.
Allowing dircmp() to accept a file comparison function is another option to consider that may address more needs going forward. shallow=False could be achieved by passing lambda a, b: filecmp.cmp(a, b, shallow=False).
planet36 commented on Jun 14, 2013
planet36mannequin
Mannequin
More actions
Add input parameter 'shallow' to dircmp.
Use it in phase3 and phase4.
Document it in filecmp.rst.
Not a bad idea. Did bpo do so? (I cannot remember either way for sure.)
Given the absence of such notices, the PR author should have requested a review from you. If not already, the devguide should say something about looking for participants (preferably recent) who are members of 'Python' or 'python/core'. (bpo starred our names on comments.)
Should the new parameter be made keyword-only? I feel we usually do that for newly added optional parameters. We have a little bit of time left before the RC phase to change this.
Activity
kesmit commented on Sep 7, 2011
While filecmp.cmp and filecmp.cmpfiles allow a shallow option to be specified to invoke a more involved comparison of files, filecmp.dircmp does not. It is limited to shallow-only comparisons.
This could be solved quite easily by adding a shallow keyword option to dircmp then changing the phase3 method to the following.
merwok commented on Mar 25, 2012
Thanks for the report. Unfortunately 2.7 is closed to new features and the module is removed in 3.x, so there is nothing to do here.
regebro commented on May 17, 2012
filecmp is still there in Python 3.3 Alpha 3. I can't find any reference to it being deprecated.
terryjreedy commented on May 29, 2012
Lennart, I saw your response on StackOverflow ;-).
cjerdonek commented on Jul 4, 2012
+1 for this.
Whether or not this feature is implemented, I think the documentation should state that directory comparisons are done using "shallow=True". I created bpo-15250 for this.
cjerdonek commented on Jul 23, 2012
Allowing dircmp() to accept a file comparison function is another option to consider that may address more needs going forward. shallow=False could be achieved by passing lambda a, b: filecmp.cmp(a, b, shallow=False).
planet36 commented on Jun 14, 2013
Add input parameter 'shallow' to dircmp.
Use it in phase3 and phase4.
Document it in filecmp.rst.
Did not modify test_filecmp.py.
rbtcollins commented on Jul 30, 2015
Thanks for the patch @planet36, however I think this is sufficiently large a change that we should also have a test case for it.
I'm also retargeting this to the current open branches for feature work - 3.6.
rbtcollins commented on Jul 30, 2015
Bah, wrong stage. patch review.
9 remaining items
merwok commented on Mar 6, 2024
Really wish github would send a notif on the issue when a PR is created to solve it!
terryjreedy commented on Mar 7, 2024
Not a bad idea. Did bpo do so? (I cannot remember either way for sure.)
Given the absence of such notices, the PR author should have requested a review from you. If not already, the devguide should say something about looking for participants (preferably recent) who are members of 'Python' or 'python/core'. (bpo starred our names on comments.)
pythongh-57141: Add dircmp shallow option (pythonGH-109499)
pythongh-57141: Add dircmp shallow option (pythonGH-109499)
JelleZijlstra commented on Jul 13, 2024
Should the new parameter be made keyword-only? I feel we usually do that for newly added optional parameters. We have a little bit of time left before the RC phase to change this.
pythongh-57141: Make shallow argument to filecmp.dircmp keyword-only
JelleZijlstra commented on Jul 14, 2024
Submitted #121767 to make the new parameter keyword-only.
gh-57141: Make shallow argument to filecmp.dircmp keyword-only (#121767)
pythongh-57141: Make shallow argument to filecmp.dircmp keyword-only (p…
[3.13] gh-57141: Make shallow argument to filecmp.dircmp keyword-only (…
pythongh-57141: Make shallow argument to filecmp.dircmp keyword-only (p…
ZeroIntensity commented on Jan 11, 2025
It looks like everything is done here, for real this time!
Backport gh-57141: Add dircmp shallow option