Commits

squeaky committed 7ee26f0

only convert to bytes when it is not bytes

Comments (0)

Files changed (1)

pystacia/api/func.py

 
 from threading import Lock
 
-from six import string_types, b as bytes_
+from six import string_types, b as bytes_, text_type
 
 from pystacia.util import memoized
 from pystacia.compat import pypy
     for arg, type in zip(args, c_method.argtypes):  # @ReservedAssignment
         if type == c_char_p:
             should_lock = True
-            arg = bytes_(arg)
+            if isinstance(arg, text_type):
+                arg = bytes_(arg)
         elif type in (c_size_t, c_ssize_t, c_uint):
             arg = int(arg)
         elif type == PixelWand_p:
     msg = formattable('Calling {0}')
     logger.debug(msg.format(method_name))
 
-    #if method == ('read', 'blob'):
-    #   from nose.tools import set_trace; set_trace();
-
     if pypy and should_lock:
         __lock.acquire()