Python 3: Fix a string conversion helper

This commit is contained in:
Houzéfa Abbasbhay 2014-12-02 16:31:04 +01:00 committed by Benjamin Dauvergne
parent e325164c8a
commit efc5429cfc
1 changed files with 2 additions and 1 deletions

View File

@ -124,7 +124,8 @@ def cptrToPy(cptr):
return o
def str2lasso(s):
if isinstance(s, unicode):
if s is not None and not isinstance(s, str):
# Assume this is a Python 2 unicode string.
return s.encode('utf-8')
return s