Matěj Cepl | 17 Apr 2012 01:38
Picon
Favicon
Gravatar

PyYAML and compatibility between python 2.6 and python 2.7

Hi,

while doing yamlish and bayeux (which uses yamlish) I have hit the 
problem of incompatibility between repo() for floats between python 2.6 
and 2.7 (and 3.1 I guess, but that isn't my problem yet, I don't support 
python 3 yet).

I have a test 
(https://gitorious.org/bayeux/bayeux/blobs/master/test/test_tap.py#line57) 
which compares results of generation of TAP (and thus yamlish) stream 
based on a JSON file. Unfortunately test fails on 2.7 with TAP file 
generated by 2.6.

Diff looks like this (there are couple of hundreds of such diffs in my 
file):

      Parameter: GL_LUMINANCE_ALPHA16F
    result: skip
    returncode: 0
-  time: 0.077721834182739258
+  time: 0.07772183418273926
    ...

The problem is the solution for bug http://bugs.python.org/issue7117.

Is there some way how to persuade PyYAML that it should generate 
representations of floats with some controllable format? (and I insist 
on generating YAML compatible stream, not generating Python objects)

Thanks for any answers,
(Continue reading)


Gmane