New submission from Batuhan <[email protected]>:
>>> tuple(difflib.context_diff(["abc"], ["bcd"], fromfile=Path("example.py")))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/difflib.py", line 1254, in context_diff
_check_types(a, b, fromfile, tofile, fromfiledate, tofiledate, lineterm)
File "/usr/local/lib/python3.9/difflib.py", line 1301, in _check_types
raise TypeError('all arguments must be str, not: %r' % (arg,))
TypeError: all arguments must be str, not: PosixPath('example.py')
IMHO to and from file arguments should accept PathLike objects. If agreed I can
prepare a patch.
----------
components: Library (Lib)
messages: 359847
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: difflib pathlike support for {unified,context}_diff() {from,to}file
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39311>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com