summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2020-05-12 02:32:40 (GMT)
committerGitHub <noreply@github.com>2020-05-12 02:32:40 (GMT)
commitf3a5b7ada0c951f317dbd307de4b410e58d3e1b3 (patch)
tree0cf526c476131c14ca3e31048896d8f0ea486213
parentb1b4c790e7d3b5f4244450aefe3d8f01710c13f7 (diff)
downloadcpython-f3a5b7ada0c951f317dbd307de4b410e58d3e1b3.zip
cpython-f3a5b7ada0c951f317dbd307de4b410e58d3e1b3.tar.gz
cpython-f3a5b7ada0c951f317dbd307de4b410e58d3e1b3.tar.bz2
bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)
These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
-rw-r--r--Lib/ipaddress.py7
-rw-r--r--Lib/test/test_genericalias.py4
-rw-r--r--Modules/mmapmodule.c2
3 files changed, 0 insertions, 13 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index 439f241..6e5a754 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -12,7 +12,6 @@ __version__ = '1.0'
import functools
-import types
IPV4LENGTH = 32
IPV6LENGTH = 128
@@ -1125,8 +1124,6 @@ class _BaseNetwork(_IPAddressBase):
return (self.network_address.is_loopback and
self.broadcast_address.is_loopback)
- __class_getitem__ = classmethod(types.GenericAlias)
-
class _BaseV4:
"""Base IPv4 object.
@@ -1446,8 +1443,6 @@ class IPv4Interface(IPv4Address):
return '%s/%s' % (self._string_from_ip_int(self._ip),
self.hostmask)
- __class_getitem__ = classmethod(types.GenericAlias)
-
class IPv4Network(_BaseV4, _BaseNetwork):
@@ -2156,8 +2151,6 @@ class IPv6Interface(IPv6Address):
def is_loopback(self):
return self._ip == 1 and self.network.is_loopback
- __class_getitem__ = classmethod(types.GenericAlias)
-
class IPv6Network(_BaseV6, _BaseNetwork):
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index 024b2f6..4f3798e 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -17,8 +17,6 @@ from ctypes import Array, LibraryLoader
from difflib import SequenceMatcher
from filecmp import dircmp
from fileinput import FileInput
-from mmap import mmap
-from ipaddress import IPv4Network, IPv4Interface, IPv6Network, IPv6Interface
from itertools import chain
from http.cookies import Morsel
from multiprocessing.managers import ValueProxy
@@ -49,7 +47,6 @@ class BaseTest(unittest.TestCase):
def test_subscriptable(self):
for t in (type, tuple, list, dict, set, frozenset, enumerate,
- mmap,
defaultdict, deque,
SequenceMatcher,
dircmp,
@@ -74,7 +71,6 @@ class BaseTest(unittest.TestCase):
Sequence, MutableSequence,
MappingProxyType, AsyncGeneratorType,
DirEntry,
- IPv4Network, IPv4Interface, IPv6Network, IPv6Interface,
chain,
TemporaryDirectory, SpooledTemporaryFile,
Queue, SimpleQueue,
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 6c503b3..a3e22d0 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -816,8 +816,6 @@ static struct PyMethodDef mmap_object_methods[] = {
#ifdef MS_WINDOWS
{"__sizeof__", (PyCFunction) mmap__sizeof__method, METH_NOARGS},
#endif
- {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS,
- PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};