mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +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
|
@ -163,15 +163,6 @@ class PurePathTest(test_pathlib_abc.DummyPurePathTest):
|
|||
# Special case for the empty path.
|
||||
self._check_str('.', ('',))
|
||||
|
||||
def test_parts_interning(self):
|
||||
P = self.cls
|
||||
p = P('/usr/bin/foo')
|
||||
q = P('/usr/local/bin')
|
||||
# 'usr'
|
||||
self.assertIs(p.parts[1], q.parts[1])
|
||||
# 'bin'
|
||||
self.assertIs(p.parts[2], q.parts[3])
|
||||
|
||||
def test_join_nested(self):
|
||||
P = self.cls
|
||||
p = P('a/b').joinpath(P('c'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue