And ignore crashing bytes regardless.
This commit is contained in:
parent
b4f8450e7d
commit
729111e9b4
1 changed files with 5 additions and 2 deletions
|
@ -44,5 +44,8 @@ class bytes(bbytes):
|
|||
|
||||
@classmethod
|
||||
def safe_decode(cls):
|
||||
'Calls cls.decode(cls, errors = "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'')
|
||||
|
|
Loading…
Reference in a new issue