]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104415: Fix refleak tests for `typing.ByteString` deprecation (#104416)
authorNikita Sobolev <mail@sobolevn.me>
Fri, 12 May 2023 12:36:12 +0000 (15:36 +0300)
committerGitHub <noreply@github.com>
Fri, 12 May 2023 12:36:12 +0000 (05:36 -0700)
Lib/typing.py

index bf7bd241972a6b0794897f003749a4657a5b70aa..513d4d96dd6e1db7c9b328e3e879f362d9219aef 100644 (file)
@@ -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)