Skip to content

Commit f3a5b7a

Browse files
authored
bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)
These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
1 parent b1b4c79 commit f3a5b7a

File tree

3 files changed

+0
-13
lines changed

3 files changed

+0
-13
lines changed

Diff for: Lib/ipaddress.py

-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
import functools
15-
import types
1615

1716
IPV4LENGTH = 32
1817
IPV6LENGTH = 128
@@ -1125,8 +1124,6 @@ def is_loopback(self):
11251124
return (self.network_address.is_loopback and
11261125
self.broadcast_address.is_loopback)
11271126

1128-
__class_getitem__ = classmethod(types.GenericAlias)
1129-
11301127
class _BaseV4:
11311128

11321129
"""Base IPv4 object.
@@ -1446,8 +1443,6 @@ def with_hostmask(self):
14461443
return '%s/%s' % (self._string_from_ip_int(self._ip),
14471444
self.hostmask)
14481445

1449-
__class_getitem__ = classmethod(types.GenericAlias)
1450-
14511446

14521447
class IPv4Network(_BaseV4, _BaseNetwork):
14531448

@@ -2156,8 +2151,6 @@ def is_unspecified(self):
21562151
def is_loopback(self):
21572152
return self._ip == 1 and self.network.is_loopback
21582153

2159-
__class_getitem__ = classmethod(types.GenericAlias)
2160-
21612154

21622155
class IPv6Network(_BaseV6, _BaseNetwork):
21632156

Diff for: Lib/test/test_genericalias.py

-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
from difflib import SequenceMatcher
1818
from filecmp import dircmp
1919
from fileinput import FileInput
20-
from mmap import mmap
21-
from ipaddress import IPv4Network, IPv4Interface, IPv6Network, IPv6Interface
2220
from itertools import chain
2321
from http.cookies import Morsel
2422
from multiprocessing.managers import ValueProxy
@@ -49,7 +47,6 @@ class BaseTest(unittest.TestCase):
4947

5048
def test_subscriptable(self):
5149
for t in (type, tuple, list, dict, set, frozenset, enumerate,
52-
mmap,
5350
defaultdict, deque,
5451
SequenceMatcher,
5552
dircmp,
@@ -74,7 +71,6 @@ def test_subscriptable(self):
7471
Sequence, MutableSequence,
7572
MappingProxyType, AsyncGeneratorType,
7673
DirEntry,
77-
IPv4Network, IPv4Interface, IPv6Network, IPv6Interface,
7874
chain,
7975
TemporaryDirectory, SpooledTemporaryFile,
8076
Queue, SimpleQueue,

Diff for: Modules/mmapmodule.c

-2
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,6 @@ static struct PyMethodDef mmap_object_methods[] = {
816816
#ifdef MS_WINDOWS
817817
{"__sizeof__", (PyCFunction) mmap__sizeof__method, METH_NOARGS},
818818
#endif
819-
{"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS,
820-
PyDoc_STR("See PEP 585")},
821819
{NULL, NULL} /* sentinel */
822820
};
823821

0 commit comments

Comments
 (0)