GH-79634: Speed up pathlib globbing by removing joinpath() call. (#114623)

Remove `self.joinpath('')` call that should have been removed in 6313cdde.

This makes `PathBase.glob('')` yield itself *without* adding a trailing slash. It's hard to say whether this is more or less correct, but at least everything else is faster, and there's no behaviour change in the public classes where empty glob patterns are disallowed.
This commit is contained in:
Barney Gale 2024-01-27 19:59:51 +00:00 committed by GitHub
parent 7a470541e2
commit 823a38a960
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View file

@ -1232,6 +1232,8 @@ class PathTest(test_pathlib_abc.DummyPathTest, PurePathTest):
list(p.glob(''))
with self.assertRaisesRegex(ValueError, 'Unacceptable pattern'):
list(p.glob('.'))
with self.assertRaisesRegex(ValueError, 'Unacceptable pattern'):
list(p.glob('./'))
def test_glob_many_open_files(self):
depth = 30