Steven Barker added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1234674>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to