diff --git a/Lib/pathlib/_local.py b/Lib/pathlib/_local.py index 674c98e1b3050ea..81705fc4e5e6799 100644 --- a/Lib/pathlib/_local.py +++ b/Lib/pathlib/_local.py @@ -273,7 +273,7 @@ def _parse_path(cls, path): 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 != '.'] + parsed = [x for x in rel.split(sep) if x and x != '.'] return drv, root, parsed @property diff --git a/Misc/NEWS.d/next/Library/2024-08-26-18-48-13.gh-issue-119518.QFYH9q.rst b/Misc/NEWS.d/next/Library/2024-08-26-18-48-13.gh-issue-119518.QFYH9q.rst new file mode 100644 index 000000000000000..819295f7306fa4f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-08-26-18-48-13.gh-issue-119518.QFYH9q.rst @@ -0,0 +1,2 @@ +Speed up normalization of :class:`pathlib.PurePath` and +:class:`~pathlib.Path` objects by not interning string parts.