Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ Removed
Python 3.4 but has been broken since Python 3.7.
(Contributed by Inada Naoki in :issue:`23882`.)

* Remove ``__class_getitem__`` method from :class:`pathlib.PurePath`,
because it was not used and added by mistake in previous versions.
(Contributed by Nikita Sobolev in :issue:`46483`.)

Porting to Python 3.11
======================
Expand Down
3 changes: 0 additions & 3 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from operator import attrgetter
from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO
from urllib.parse import quote_from_bytes as urlquote_from_bytes
from types import GenericAlias


__all__ = [
Expand Down Expand Up @@ -691,8 +690,6 @@ def __ge__(self, other):
return NotImplemented
return self._cparts >= other._cparts

__class_getitem__ = classmethod(GenericAlias)

drive = property(attrgetter('_drv'),
doc="""The drive prefix (letter or UNC path), if any.""")

Expand Down
9 changes: 0 additions & 9 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2429,15 +2429,6 @@ def test_complex_symlinks_relative(self):
def test_complex_symlinks_relative_dot_dot(self):
self._check_complex_symlinks(os.path.join('dirA', '..'))

def test_class_getitem(self):
from types import GenericAlias

alias = self.cls[str]
self.assertIsInstance(alias, GenericAlias)
self.assertIs(alias.__origin__, self.cls)
self.assertEqual(alias.__args__, (str,))
self.assertEqual(alias.__parameters__, ())


class PathTest(_BasePathTest, unittest.TestCase):
cls = pathlib.Path
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove :meth:`~object.__class_getitem__` from :class:`pathlib.PurePath` as this class was not supposed to be generic.