mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
bpo-31281: Fix pathlib.Path incompatibility in fileinput (gh-3208)
Fix fileinput with inplace=True to accept pathlib.Path objects.
This commit is contained in:
parent
a2344851ab
commit
06de1aeff9
3 changed files with 16 additions and 1 deletions
|
@ -330,7 +330,7 @@ class FileInput:
|
|||
else:
|
||||
if self._inplace:
|
||||
self._backupfilename = (
|
||||
self._filename + (self._backup or ".bak"))
|
||||
os.fspath(self._filename) + (self._backup or ".bak"))
|
||||
try:
|
||||
os.unlink(self._backupfilename)
|
||||
except OSError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue