Custom Query (132 matches)


Show under each result:

Results (7 - 9 of 132)

1 2 3 4 5 6 7 8 9 10 11 12 13
Ticket Resolution Summary Owner Reporter
#21 duplicate yaml emitter bug xi rwb123@…

Reported by rwb123@…, 8 years ago.


The following code produces bad yaml output, which subsequently dies in the yaml.load(). This is with pyyaml 3.0.3 on python 2.4.1.

import yaml

e = {"texas: '": 92.5}
yammy = yaml.dump(e)
print yammy
e2 = yaml.load(yammy)
print e2

The yaml output is:

$ python
{'texas: '': 92.5}

Traceback (most recent call last):
  File "", line 10, in ?
    e2 = yaml.load(yammy)
  File "/home/blahblah/dl/yaml/PyYAML-3.03/lib/yaml/", line 61, in load
    return loader.get_data()
 ... etc.
#49 fixed yaml confused by python float repr() xi cems a.t.

Reported by cems a.t., 7 years ago.


platform: intel macintosh, python2.5 , latest yaml.

Description: depending on a floats value dump() will output a different representation format. Sometimes it uses a tag format and others a standard float notation depending on the value.


In [160]:dat ="""
float1: 1.0E-8
float2: 1.0E-9

In [165]:t = yaml.load(dat)

In [166]:t
Out[166]:{'float1': 1e-08, 'float2': 1.0000000000000001e-09}

In [167]:yaml.dump(t)
Out[167]:"{float1: !!float '1e-08', float2: 1.0000000000000001e-09}\n"

notice the !!float tag followed by a string.

regression: this appears to be an attempt to compensate for fact that python's string representation of some float values having different formats: that is in python2.5 the repr() of 1.0e-8 is actually 1e-08 (it supresses the decimal point). Since YAML does not recognize floats without the decimal point the dump command adds the float tag. However while the repr() of 1.0E-9 is 1.0000000000000001e-09. which has the decimal point making it legal YAML and it dump avoids the float tag

It seems to me that a more consistent and desirable result would be obtained if dump were to output 1e-8 as 1.0e-8 rather than using the float if one is parsing a yaml file in another language the tagged format of the float can't be read easily. (e.g. consider reading this in fortran or perl without using a yaml lib to read the file.)

#62 fixed value token of single period ('.') is parsed incorrectly, throws wrong exception xi sproaticus

Reported by sproaticus, 7 years ago.


A scalar value token consisting of just a period ('.') is interpreted as a float value. When construct_yaml_float() creates a float using this value, it throws an uncaught ValueError instead of yaml.YAMLError

(Also, what's PIL doing in the stack? I didn't import it.)

>>> yaml.load('yaml: .')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/PIL/", line 66, in load
  File "build/bdist.linux-i686/egg/yaml/", line 38, in get_data
  File "build/bdist.linux-i686/egg/yaml/", line 46, in construct_document
  File "build/bdist.linux-i686/egg/yaml/", line 394, in construct_yaml_map
  File "build/bdist.linux-i686/egg/yaml/", line 207, in construct_mapping
  File "build/bdist.linux-i686/egg/yaml/", line 132, in construct_mapping
  File "build/bdist.linux-i686/egg/yaml/", line 87, in construct_object
  File "build/bdist.linux-i686/egg/yaml/", line 281, in construct_yaml_float
ValueError: invalid literal for float(): .


  • Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
  • PyYAML-3.05-py2.5.egg
1 2 3 4 5 6 7 8 9 10 11 12 13
Note: See TracQuery for help on using queries.