Skip to content

Commit 910ca47

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 fb819d6 commit 910ca47

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
@@ -322,10 +322,10 @@ def with_name(self, name):
322322
'Return a sibling Path with *name* as a filename in the same directory.'
323323
if self.is_url():
324324
urlparts = list(urlparse(self.given))
325-
urlparts[2] = '/'.join(Path(urlparts[2])._parts[1:-1] + [name])
325+
urlparts[2] = '/'.join(list(Path(urlparts[2]).parts[1:-1]) + [name])
326326
return Path(urlunparse(urlparts))
327327
else:
328-
return Path(self._from_parsed_parts(self._drv, self._root, self._parts[:-1] + [name]))
328+
return Path(self._from_parsed_parts(self._drv, self._root, list(self.parts[:-1]) + [name]))
329329

330330

331331
class RepeatFile:

0 commit comments

Comments
 (0)