Commits

Kirill Simonov  committed 24fd588

Fixed an issue with ReaderError generated by the LibYAML wrapper.

  • Participants
  • Parent commits 659ccb6

Comments (0)

Files changed (2)

File lib/yaml/reader.py

         else:
             return "unacceptable character #x%04x: %s\n"    \
                     "  in \"%s\", position %d"    \
-                    % (ord(self.character), self.reason,
+                    % (self.character, self.reason,
                             self.name, self.position)
 
 class Reader(object):
         if match:
             character = match.group()
             position = self.index+(len(self.buffer)-self.pointer)+match.start()
-            raise ReaderError(self.name, position, character,
+            raise ReaderError(self.name, position, ord(character),
                     'unicode', "special characters are not allowed")
 
     def update(self, length):

File tests/data/invalid-utf8-byte.loader-error

--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
+***************************************************************
 Invalid byte ('\xFF'): � <--
--------------------------------------------------------------------------------------------------------------------------------
+***************************************************************