gh-91896: Improve visibility of ByteString deprecation warnings (#104294)

This commit is contained in:
Alex Waygood 2023-05-12 07:01:31 +01:00 committed by GitHub
parent a0a98ddb31
commit f0f5bb3204
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 85 additions and 12 deletions

View file

@ -1,3 +1,12 @@
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
_deprecated_ByteString = globals().pop("ByteString")
def __getattr__(attr):
if attr == "ByteString":
import warnings
warnings._deprecated("collections.abc.ByteString", remove=(3, 14))
return _deprecated_ByteString
raise AttributeError(f"module 'collections.abc' has no attribute {attr!r}")