Commits

Anonymous committed 2cfff46

py3 opt (don't really why but seems to work ;)

  • Participants
  • Parent commits fd4aa07

Comments (0)

Files changed (1)

File src/cssutils/_codec3.py

 
 
 def decode(input, errors="strict", encoding=None, force=True):
+    try:
+        # py 3 only, memory?! object to bytes
+        input = input.tobytes()
+    except AttributeError as e:
+        pass
+    
     if encoding is None or not force:
         (_encoding, explicit) = detectencoding_str(input, True)
         if _encoding == "css":
             
     # NEEDS: change in parse.py (str to bytes!)
     (input, consumed) = codecs.getdecoder(encoding)(input, errors)
-    
-#    if sys.version_info < (3,):
-#        (input, consumed) = codecs.getdecoder(encoding)(input, errors)
-#    else:
-#        # TODO: does this make sense at all?
-#        #(input, consumed) = codecs.getdecoder(encoding)(bytes(input, encoding), errors)
-    
     return (_fixencoding(input, str(encoding), True), consumed)