[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-20 Thread Berker Peksag
Changes by Berker Peksag : -- stage: commit review -> resolved ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-20 Thread Greg Ward
Changes by Greg Ward : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1764d42b340d by Greg Ward in branch 'default': #17445: difflib: add diff_bytes(), to compare bytes rather than str https://hg.python.org/cpython/rev/1764d42b340d -- nosy: +python-dev ___ Python tracker <

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-16 Thread Berker Peksag
Berker Peksag added the comment: Thanks, looks great. Two trivial comments about the documentation: * Needs ``.. versionadded:: 3.5`` * *dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)* -> ``dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)`` --

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-16 Thread Greg Ward
Greg Ward added the comment: Just uploaded https://bugs.python.org/file39083/fa4c6160c518.diff. Pretty sure I've addressed all of @berker.peksag's review comments: thanks for that! I also fixed a number of subtle bugs in the tests. Pro tip: when asserting that something raises TypeError, insp

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-16 Thread Greg Ward
Changes by Greg Ward : Added file: http://bugs.python.org/file39083/fa4c6160c518.diff ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-16 Thread Nick Coghlan
Nick Coghlan added the comment: I think the convert to str -> process as str -> convert back to bytes approach is a good one - it's the same one we use in urllib.parse. In this case, since we explicit need to handle mixed encodings, I also agree with the idea of using surrogate escape to make

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: Now the review button appears for the big patch. Lets see if another submission makes it appear for the smaller version. -- ___ Python tracker ___

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-15 Thread Augie Fackler
Augie Fackler added the comment: Changes to 3.4 aren't going to help Mercurial. Given that bytes formatting is new in 3.5, I won't be attempting a port that supports a version of Python 3 any older than 3.5. At this point, just a difflib.diff_bytes method in 3.5 would be sufficient to satisfy

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: I tried the [Create Patch] button. Two problems: the result is about 90% concerned with other issues; it is not reviewable on Rietveld. I will unlink it and upload a cut-down version. Wtiht the test changes suggested by Berker, I agree that it is time to app

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-15 Thread Terry J. Reedy
Changes by Terry J. Reedy : Added file: http://bugs.python.org/file39053/13161c1d9c5f.diff ___ Python tracker ___ ___ Python-bugs-list mailing

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-15 Thread Berker Peksag
Berker Peksag added the comment: Some small comments: * diff_bytes needs to be documented in the difflib docs and in Doc/whatsnew/3.5.rst. * diff_bytes needs to be added to difflib.__all__ * This looks like a new feature to me, so it would be better to just commit it to the default branch.

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-15 Thread Greg Ward
Greg Ward added the comment: OK I've revived my patch and rebased on latest trunk. http://hg.gerg.ca/cpython/rev/13161c1d9c5f Comments welcome. I'll push this in a couple of days if nobody objects. -- ___ Python tracker

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-13 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: +Python 3.5 -Python 3.3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-13 Thread Augie Fackler
Augie Fackler added the comment: (For values of "our" == "Mercurial".) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-13 Thread Augie Fackler
Augie Fackler added the comment: Friendly ping. With bytes formatting in Python 3.5a3, this is now the biggest pain port for getting our test runner working cleanly on Python 3. -- ___ Python tracker _

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-24 Thread Greg Ward
Greg Ward added the comment: > I recommend the following: replace the simple test in the attached > bytes_diff.py with > Greg's unittest-based tests and adjust the __name__ == '__main__' incantation > accordingly. Latest patch, following Terry's suggestion: http://hg.gerg.ca/cpython/rev/6718

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: The surrogate escape approach embodies the 3.x recommendation: decode bytes to strings, manipulate strings, encode strings to bytes. It also makes it possible to wrap the existing context/unified_diff functions, without touching them, with a simple 12 line funct

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-19 Thread R. David Murray
Changes by R. David Murray : Removed file: http://bugs.python.org/file29486/6dedcdbe7cd5.diff ___ Python tracker ___ ___ Python-bugs-list mail

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-19 Thread R. David Murray
Changes by R. David Murray : -- keywords: +patch Added file: http://bugs.python.org/file29486/6dedcdbe7cd5.diff ___ Python tracker ___ ___

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-18 Thread Greg Ward
Greg Ward added the comment: Thanks for the review, Terry! Here is a revised patch, now on trunk: http://hg.gerg.ca/cpython/rev/6dedcdbe7cd5 I believe I have addressed all of your concerns. Note also that the tests now highlight some dubious behaviour. Further feedback is welcome! I'm happ

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-18 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, I forgot we didn't do within-line diffs. If we did those, then latin-1 would be less bad choice than ascii+surrogateescape. As it is, either should work in this case (since they just need to tunnel the raw bytes, and aren't being sliced at all). I agree wit

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: I was about to suggested a simplified version of the original one-function version but the new one is better. One change: name = lambda... is discouraged in the stdlib (Guido, pydev, a few years ago). Def statements require only 3 more chars and produce proper

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-18 Thread Greg Ward
Greg Ward added the comment: Take 3: http://hg.gerg.ca/cpython/rev/78bdb10551ee - uses surrogateescape as suggested by Antoine - seems to work -- ___ Python tracker ___ _

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-18 Thread Nick Coghlan
Nick Coghlan added the comment: Since we don't need to worry about ASCII incompatible encodings (difflib will already have issues with such files due to the assumptions about newlines), it should be possible to use the same approach as that used in urllib.parse, but based on latin-1 rather tha