GH-128520: Merge pathlib._abc into pathlib.types (#130747)

There used to be a meaningful distinction between these modules: `pathlib`
imported `pathlib._abc` but not `pathlib.types`. This is no longer the
case (neither module is imported), so we move the ABCs as follows:

- `pathlib._abc.JoinablePath` --> `pathlib.types._JoinablePath`
- `pathlib._abc.ReadablePath` --> `pathlib.types._ReadablePath`
- `pathlib._abc.WritablePath` --> `pathlib.types._WritablePath`
This commit is contained in:
Barney Gale 2025-03-03 17:56:57 +00:00 committed by GitHub
parent 321bf59512
commit d0eb01c9de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 406 additions and 410 deletions

View file

@ -1059,14 +1059,14 @@ class PathTest(test_pathlib_abc.RWPathTest, PurePathTest):
return d
def test_matches_writablepath_docstrings(self):
path_names = {name for name in dir(pathlib._abc.WritablePath) if name[0] != '_'}
path_names = {name for name in dir(pathlib.types._WritablePath) if name[0] != '_'}
for attr_name in path_names:
if attr_name == 'parser':
# On Windows, Path.parser is ntpath, but WritablePath.parser is
# posixpath, and so their docstrings differ.
continue
our_attr = getattr(self.cls, attr_name)
path_attr = getattr(pathlib._abc.WritablePath, attr_name)
path_attr = getattr(pathlib.types._WritablePath, attr_name)
self.assertEqual(our_attr.__doc__, path_attr.__doc__)
def test_concrete_class(self):