New submission from Anthony Sottile <asott...@umich.edu>:

Here's an example

from difflib import ndiff


def main():
    x = '\tx\t=\ty\n\t \t \t^'
    y = '\tx\t=\ty\n\t \t \t^\n'
    print('\n'.join(
        line.rstrip('\n') for line in
        ndiff(x.splitlines(True), y.splitlines(True)))
    )


if __name__ == '__main__':
    exit(main())


Current output:

$ python3.8 t.py
        x       =       y
-                       ^
+                       ^
?            +


Expected output:

$ ./python t.py
        x       =       y
-                       ^
+                       ^
?                        +


Found this while implementing a similar thing for flake8 here: 
https://gitlab.com/pycqa/flake8/merge_requests/339 and while debugging with 
pytest

----------
messages: 349353
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: ndiff reports incorrect location when diff strings contain tabs
versions: Python 3.7, Python 3.8, Python 3.9

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

Reply via email to