Skip to content

Commit 023a615

Browse files
committed
Address review
1 parent e8f6c3d commit 023a615

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Lib/test/test_typing.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6004,17 +6004,16 @@ def test_mutablesequence(self):
60046004
self.assertNotIsInstance((), typing.MutableSequence)
60056005

60066006
def test_bytestring(self):
6007-
_typing = import_fresh_module('typing')
60086007
with self.assertWarns(DeprecationWarning):
6009-
ByteString = _typing.ByteString
6008+
from typing import ByteString
60106009
with self.assertWarns(DeprecationWarning):
60116010
self.assertIsInstance(b'', ByteString)
60126011
with self.assertWarns(DeprecationWarning):
60136012
self.assertIsInstance(bytearray(b''), ByteString)
60146013
with self.assertWarns(DeprecationWarning):
60156014
class Foo(ByteString): ...
60166015
with self.assertWarns(DeprecationWarning):
6017-
class Bar(ByteString, _typing.Awaitable): ...
6016+
class Bar(ByteString, typing.Awaitable): ...
60186017

60196018
def test_list(self):
60206019
self.assertIsSubclass(list, typing.List)

Lib/typing.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3586,3 +3586,12 @@ def __getattr__(attr):
35863586
)
35873587
return ByteString
35883588
raise AttributeError(f"module 'typing' has no attribute {attr!r}")
3589+
3590+
3591+
def _remove_cached_ByteString_from_globals():
3592+
try:
3593+
del globals()["ByteString"]
3594+
except KeyError:
3595+
pass
3596+
3597+
_cleanups.append(_remove_cached_ByteString_from_globals)

0 commit comments

Comments
 (0)