Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions Lib/ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


import functools
import types

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

__class_getitem__ = classmethod(types.GenericAlias)

class _BaseV4:

Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_genericalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
)
from collections.abc import *
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from ipaddress import _BaseNetwork
from os import DirEntry
from re import Pattern, Match
from types import GenericAlias, MappingProxyType
Expand Down Expand Up @@ -35,7 +36,7 @@ def test_subscriptable(self):
Mapping, MutableMapping, MappingView,
KeysView, ItemsView, ValuesView,
Sequence, MutableSequence,
MappingProxyType, DirEntry
MappingProxyType, DirEntry, _BaseNetwork
Comment thread
isidentical marked this conversation as resolved.
Resolved
):
tname = t.__name__
with self.subTest(f"Testing {tname}"):
Expand Down