mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
GH-101362: Omit path anchor from pathlib.PurePath()._parts
(GH-102476)
Improve performance of path construction by skipping the addition of the path anchor (`drive + root`) to the internal `_parts` list. Rename this attribute to `_tail` for clarity.
This commit is contained in:
parent
0a675f4bb5
commit
2c673d5e93
3 changed files with 108 additions and 67 deletions
|
@ -346,8 +346,6 @@ class _BasePurePathTest(object):
|
|||
p = P('a/b')
|
||||
parts = p.parts
|
||||
self.assertEqual(parts, ('a', 'b'))
|
||||
# The object gets reused.
|
||||
self.assertIs(parts, p.parts)
|
||||
# When the path is absolute, the anchor is a separate part.
|
||||
p = P('/a/b')
|
||||
parts = p.parts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue