Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-39481: remove generic classes from ipaddress/mmap #20045

Merged
merged 1 commit into from
May 12, 2020
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
7 changes: 0 additions & 7 deletions Lib/ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


import functools
import types

IPV4LENGTH = 32
IPV6LENGTH = 128
Expand Down Expand Up @@ -1125,8 +1124,6 @@ def is_loopback(self):
return (self.network_address.is_loopback and
self.broadcast_address.is_loopback)

__class_getitem__ = classmethod(types.GenericAlias)

class _BaseV4:

"""Base IPv4 object.
Expand Down Expand Up @@ -1446,8 +1443,6 @@ def with_hostmask(self):
return '%s/%s' % (self._string_from_ip_int(self._ip),
self.hostmask)

__class_getitem__ = classmethod(types.GenericAlias)


class IPv4Network(_BaseV4, _BaseNetwork):

Expand Down Expand Up @@ -2156,8 +2151,6 @@ def is_unspecified(self):
def is_loopback(self):
return self._ip == 1 and self.network.is_loopback

__class_getitem__ = classmethod(types.GenericAlias)


class IPv6Network(_BaseV6, _BaseNetwork):

Expand Down
4 changes: 0 additions & 4 deletions Lib/test/test_genericalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
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
Expand Down Expand Up @@ -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,
Expand All @@ -74,7 +71,6 @@ def test_subscriptable(self):
Sequence, MutableSequence,
MappingProxyType, AsyncGeneratorType,
DirEntry,
IPv4Network, IPv4Interface, IPv6Network, IPv6Interface,
chain,
TemporaryDirectory, SpooledTemporaryFile,
Queue, SimpleQueue,
Expand Down
2 changes: 0 additions & 2 deletions Modules/mmapmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

Expand Down