Package: python-syck
Version: 0.42-5

Hello again!

After trying to use ydump/syck some more, I ran into the problem that
'?' characters aren't escaped correctly, it seems.  I decided to write a
short program to try all the ASCII characters and see which don't work:

import syck, ydump
for i in xrange(128):
        c = chr(i)
        try:
                assert syck.load(ydump.dump(c)) == c
        except:
                print "failed for chr(%d) = '%s'" % (i,c)

On my computer, this generates:

failed for chr(0) = ''
failed for chr(10) = '
'
failed for chr(32) = ' '
failed for chr(33) = '!'
failed for chr(44) = ','
failed for chr(62) = '>'
failed for chr(63) = '?'
failed for chr(91) = '['
failed for chr(93) = ']'
failed for chr(123) = '{'
failed for chr(124) = '|'
failed for chr(125) = '}'
failed for chr(126) = '~'

(These may look familiar: they have special meanings in YAML, and are
listed on the YAML reference card at <http://yaml.org/refcard.html>.)

I think this could be fixed (as before) by simply adding these
characters to the needsSingleQuote() function; a simple (but probably
not optimal) way to do it would be to add the lines:

if data[0] in ['\n',' ','!',',','>','?','[',']','{','|','}','~']:
        return 1

(chr(0) seems to be dumped correctly, but Syck refuses to load a string
that contains '\0'.  I have no idea know how hard this would be to fix.
I'll file a separate bug for this.)

While I'm at it, I tried putting other special names from the YAML
reference card through syck/ydump, and these also failed:
- 'null' (upper-, lower-, and title-case only)
- '.inf' (upper-, lower-, and title-case only)
- '.nan' (upper-, lower-, and title-case only)

These should also be fairly easy to fix in needsSingleQuote().


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages python-syck depends on:
ii  python                        2.3.4-6    An interactive high-level
object-o
ii  python2.3-syck                0.42-5     YAML parser kit -- Python
2.3 bind

-- no debconf information




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to