Custom Query (132 matches)


Show under each result:

Results (40 - 42 of 132)

Ticket Resolution Summary Owner Reporter
#137 fixed PROPOSED FIX:memory corruption and bad aliases xi cegner@…

Reported by cegner@…, 5 years ago.


Libyaml 0.1.2 fails to serialize python longs correctly. The pure python implementation produces correct output. This is a major issue for us since we make heavy use of yaml and the pure python implementation is too slow for our needs (not a criticism, just a statement of fact).

I've given this 'blocker' severity and high priority since long is a basic python type. If this is inappropriate, please let me know. When is the next scheduled release of libyaml?

Minimal test case:

>>> import yaml
>>> from yaml import Dumper
>>> from yaml import CDumper
>>> yaml.__version__
>>> # libyaml doesn't have __version__ support but is 0.1.2

>>> d = { 'hourEastern': 20L, 'hour_eastern': 20L }
>>> yaml.dump( d, Dumper = CDumper )
'{hourEastern: &20 !!python/long 20, hour_eastern: *id001}\n'
>>> yaml.dump( d, Dumper = Dumper )
"{hourEastern: &id001 !!python/long '20', hour_eastern: *id001}\n"

#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.)

#54 fixed load() fails to load consecutive documents xi cems at lanl dot gov

Reported by cems at lanl dot gov, 7 years ago.


Description: if a file contains multiple documents, yaml.load() fails to work after the first document is read.

I have a text file called test.yml that looks like this: --- as: "333 775260" --- zz: "top"

the following code works as expected:

f = open("test.xml") x = yaml.load_all(f) [ i for i in x]

that loads both documents. it does it lazily using a generator x.

The following does NOT work as exepcted: f = open("test.xml") yaml.load(f) yaml.load(f)

the first yaml.load(f) works and loads the first document. the second one fails. From the documentation I beleive yaml.load should consecutively load the next document upon each invocation on the stream. The error message upon failing to load varies depending upon what is in the second document. In the case shown here is the stack trace from ipython2.5

In [153]: f = open("test4.yml")

In [154]: yaml.load(f) Out[154]: {'as': '333 775260'}

In [155]: yaml.load(f)

<type 'exceptions.AttributeError?'> Traceback (most recent call last)

/Users/cems/Documents/Collaboration/brettin/poisson_estimates/ace_to_yaml/<ipython console> in <module>()

/sw/lib/python2.5/site-packages/yaml/ in load(stream, Loader)

64 loader = Loader(stream) 65 if loader.check_data():

---> 66 return loader.get_data()

67 68 def safe_load_all(stream):

/sw/lib/python2.5/site-packages/yaml/ in get_data(self)

36 # Construct and return the next document. 37 if self.check_node():

---> 38 return self.construct_document(self.get_node())

39 40 def g(): yield None

/sw/lib/python2.5/site-packages/yaml/ in get_node(self)

21 # Get the root node of the next document. 22 if not self.check_event(StreamEndEvent?):

---> 23 return self.compose_document()

24 25 def compose_document(self):

/sw/lib/python2.5/site-packages/yaml/ in compose_document(self)

33 34 # Compose the root node.

---> 35 node = self.compose_node(None, None)

36 37 # Drop the DOCUMENT-END event.

/sw/lib/python2.5/site-packages/yaml/ in compose_node(self, parent, index)

50 return self.anchors[anchor] 51 event = self.peek_event()

---> 52 anchor = event.anchor

53 if anchor is not None: 54 if anchor in self.anchors:

<type 'exceptions.AttributeError?'>: 'NoneType?' object has no attribute 'anchor'

In [156]:

Note: See TracQuery for help on using queries.