Handle converting None to byte data (b'').
This commit is contained in:
parent
88b5e60807
commit
6819b57353
3
sleekxmpp/thirdparty/suelta/util.py
vendored
3
sleekxmpp/thirdparty/suelta/util.py
vendored
@ -15,6 +15,9 @@ def bytes(text):
|
|||||||
:param text: Unicode text to convert to bytes
|
:param text: Unicode text to convert to bytes
|
||||||
:rtype: bytes (Python3), str (Python2.6+)
|
:rtype: bytes (Python3), str (Python2.6+)
|
||||||
"""
|
"""
|
||||||
|
if text is None:
|
||||||
|
return b''
|
||||||
|
|
||||||
if sys.version_info < (3, 0):
|
if sys.version_info < (3, 0):
|
||||||
import __builtin__
|
import __builtin__
|
||||||
return __builtin__.bytes(text)
|
return __builtin__.bytes(text)
|
||||||
|
Loading…
Reference in New Issue
Block a user