mirror of
https://github.com/python/cpython.git
synced 2025-09-22 00:12:56 +00:00
GH-112361: Speed up pathlib by removing some temporary objects. (#112362)
Construct only one new list object (using `list.copy()`) when creating a new path object with a modified tail. This slightly speeds up `with_name()` and `with_suffix()`
This commit is contained in:
parent
6b961b8cea
commit
19a1fc1b3d
3 changed files with 14 additions and 22 deletions
|
@ -575,8 +575,6 @@ class PurePathTest(unittest.TestCase):
|
|||
self.assertRaises(ValueError, P('a/b').with_suffix, '.c/.d')
|
||||
self.assertRaises(ValueError, P('a/b').with_suffix, './.d')
|
||||
self.assertRaises(ValueError, P('a/b').with_suffix, '.d/.')
|
||||
self.assertRaises(ValueError, P('a/b').with_suffix,
|
||||
(self.pathmod.sep, 'd'))
|
||||
|
||||
def test_relative_to_common(self):
|
||||
P = self.cls
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue