[New-bugs-announce] [issue39311] difflib pathlike support for {unified, context}_diff() {from, to}file

Batuhan report at bugs.python.org
Sun Jan 12 07:58:02 EST 2020


New submission from Batuhan <batuhanosmantaskaya at gmail.com>:

>>> 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 <report at bugs.python.org>
<https://bugs.python.org/issue39311>
_______________________________________


More information about the New-bugs-announce mailing list