summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-05-12 12:36:12 (GMT)
committerGitHub <noreply@github.com>2023-05-12 12:36:12 (GMT)
commit5b8cd5abe5924646b9ed90e7ba90085b56d5f634 (patch)
tree590a540ce97e6bcac621314c163a4241a9851c34 /Lib
parentd50c37d8adb2d2da9808089d959ca7d6791ac59f (diff)
downloadcpython-5b8cd5abe5924646b9ed90e7ba90085b56d5f634.zip
cpython-5b8cd5abe5924646b9ed90e7ba90085b56d5f634.tar.gz
cpython-5b8cd5abe5924646b9ed90e7ba90085b56d5f634.tar.bz2
gh-104415: Fix refleak tests for `typing.ByteString` deprecation (#104416)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/typing.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index bf7bd24..513d4d9 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -3586,3 +3586,12 @@ def __getattr__(attr):
)
return ByteString
raise AttributeError(f"module 'typing' has no attribute {attr!r}")
+
+
+def _remove_cached_ByteString_from_globals():
+ try:
+ del globals()["ByteString"]
+ except KeyError:
+ pass
+
+_cleanups.append(_remove_cached_ByteString_from_globals)