And ignore crashing bytes regardless.

This commit is contained in:
Firepup Sixfifty 2023-11-14 16:16:39 -06:00
parent b4f8450e7d
commit 729111e9b4
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

View file

@ -44,5 +44,8 @@ class bytes(bbytes):
@classmethod
def safe_decode(cls):
'Calls cls.decode(cls, errors = "ignore")'
return cls.decode(cls, errors = "ignore") # type: ignore
'Calls cls.decode(cls, errors = "ignore"), if that errors, returns a blank bytes object'
try:
return cls.decode(cls, errors = "ignore") # type: ignore
except TypeError:
return bytes(b'')