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.

Author Steven.Barker
Recipients Andrew.Kubera, Steven.Barker, chris.jerdonek, fdrake, georg.brandl, goatsofmendez, pvrijlandt, rhettinger, sandro.tosi
Date 2014-07-27.13:22:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406467366.42.0.199671501835.issue1234674@psf.upfronthosting.co.za>
In-reply-to
Content
I think that your test patch misses the confusing/possibly wrong case. That case is when two files have the same contents, but different mtimes. If you attempt a shallow comparison, you'll actually get a deep comparison (reading the whole files) and a result of True rather than the expected (though incorrect) False.

Try the test part of my patch (without the behavior change), and you'll see the failure of "test_shallow_false_negative". In your first assertion (that "filecmp.cmp(self.name, self.name_uppercase)" is False), you get the expected result, but for the wrong reason (you get it because the file contents differ, not because they have different mtimes).

Now, it might be that the "bad" case is actually working as we want it to (or at least, the behavior is established enough that we don't want to change it, for risk of breaking running code). If so, we should instead change the documentation (and especially the docstring) to explicit state that even if you request a shallow comparison, you might get a deep comparison instead.
History
Date User Action Args
2014-07-27 13:22:46Steven.Barkersetrecipients: + Steven.Barker, fdrake, georg.brandl, rhettinger, pvrijlandt, goatsofmendez, sandro.tosi, chris.jerdonek, Andrew.Kubera
2014-07-27 13:22:46Steven.Barkersetmessageid: <1406467366.42.0.199671501835.issue1234674@psf.upfronthosting.co.za>
2014-07-27 13:22:46Steven.Barkerlinkissue1234674 messages
2014-07-27 13:22:46Steven.Barkercreate