]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
pybind: Don't encode str on Python 2
authorDavid Coles <dcoles@gaikai.com>
Tue, 20 Oct 2015 02:42:18 +0000 (19:42 -0700)
committerDavid Coles <dcoles@gaikai.com>
Fri, 13 Nov 2015 01:26:01 +0000 (17:26 -0800)
commit47d9ca7dadcb7c5333d83eb85e1ad39980486baa
tree6a70aff30031d3e94b0217cd2283667afea27c80
parent904c0e950ab1e903c560339cdb1f74ed1b863dad
pybind: Don't encode str on Python 2

If you attempt to call encode on a non-ASCII string, then a UnicodeDecodeError
will be raised.

Since str on Python 2 is an 8-bit string, it's possible that it's already UTF-8
encoded. As such we should just pass it through to the C API unmodified.

On Python 3 or if the user explicitly uses unicode, then we'll encode it to
UTF-8 for them.

Signed-off-by: David Coles <dcoles@gaikai.com>
src/pybind/rados.py
src/pybind/rbd.py