mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
GH-119518: Stop interning strings in pathlib GH-123356)
Remove `sys.intern(str(x))` calls when normalizing a path in pathlib. This speeds up `str(Path('foo/bar'))` by about 10%.
This commit is contained in:
parent
77a2fb4bf1
commit
5002f17794
3 changed files with 3 additions and 11 deletions
|
@ -272,8 +272,7 @@ class PurePath(PurePathBase):
|
|||
elif len(drv_parts) == 6:
|
||||
# e.g. //?/unc/server/share
|
||||
root = sep
|
||||
parsed = [sys.intern(str(x)) for x in rel.split(sep) if x and x != '.']
|
||||
return drv, root, parsed
|
||||
return drv, root, [x for x in rel.split(sep) if x and x != '.']
|
||||
|
||||
@property
|
||||
def _raw_path(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue