Skip to content

Commit 2b3a569

Browse files
committed
[path] update Path for Python 3.12
`pathlib.Path._parts` has been removed in Python 3.12: python/cpython#102476 Switch to pathlib.Path.parts which is a tuple. Closes #1934
1 parent cdfe4af commit 2b3a569

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

visidata/path.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,10 @@ def with_name(self, name):
324324
'Return a sibling Path with *name* as a filename in the same directory.'
325325
if self.is_url():
326326
urlparts = list(urlparse(self.given))
327-
urlparts[2] = '/'.join(Path(urlparts[2])._parts[1:-1] + [name])
327+
urlparts[2] = '/'.join(list(Path(urlparts[2]).parts[1:-1]) + [name])
328328
return Path(urlunparse(urlparts))
329329
else:
330-
return Path(self._from_parsed_parts(self._drv, self._root, self._parts[:-1] + [name]))
330+
return Path(self._from_parsed_parts(self._drv, self._root, list(self.parts[:-1]) + [name]))
331331

332332

333333
class RepeatFile:

0 commit comments

Comments
 (0)