Custom Query (121 matches)
Results (1 - 3 of 121)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #26 | fixed | yaml.load("a: n") raises exception (problem with bool) | xi | zbynek.winkler@… |
| Description |
r59 claims to "Remove y/n from the boolean constants." However 'n|N' is not removed from the corresponding regexp. BTW: why was it removed? Looking at http://yaml.org/type/bool.html one would expect it to be there. |
|||
| #39 | fixed | yaml.load("") raises an exception | xi | iusty@… |
| Description |
With the latest PyYAML (3.04): $ python
Python 2.4.4 (#2, Oct 19 2006, 23:03:48)
[GCC 4.1.2 20061007 (prerelease) (Debian 4.1.1-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.load("")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local//lib/python2.4/site-packages/yaml/__init__.py", line 66, in load
return loader.get_data()
File "/usr/local//lib/python2.4/site-packages/yaml/constructor.py", line 38, in get_data
return self.construct_document(self.get_node())
File "/usr/local//lib/python2.4/site-packages/yaml/composer.py", line 23, in get_node
return self.compose_document()
File "/usr/local//lib/python2.4/site-packages/yaml/composer.py", line 35, in compose_document
node = self.compose_node(None, None)
File "/usr/local//lib/python2.4/site-packages/yaml/composer.py", line 52, in compose_node
anchor = event.anchor
AttributeError: 'NoneType' object has no attribute 'anchor'
>>>
I think this is a bug - at least it should raise a yaml.scanner.ScannerError?, like yaml.load("'") does, and then it can be easily catched as a malformed stream. Right now, it's hard to deal with this. Thanks, Iustin |
|||
| #80 | wontfix | yaml.load doesn't work as i suspect it to according to the documentation | xi | anonymous |
| Description |
quote from the documentation: >>> class Monster(yaml.YAMLObject):
... yaml_tag = u'!Monster'
... def __init__(self, name, hp, ac, attacks):
... self.name = name
... self.hp = hp
... self.ac = ac
... self.attacks = attacks
... def __repr__(self):
... return "%s(name=%r, hp=%r, ac=%r, attacks=%r)" % (
... self.__class__.__name__, self.name, self.hp, self.ac, self.attacks)
>>> yaml.load("""
... --- !Monster
... name: Cave spider
... hp: [2,6] # 2d6
... ac: 16
... attacks: [BITE, HURT]
... """)
the thing is, yaml.load ignores the __init__ method of the Monster class. it doesn't even matter if it's there at all. in yaml.load you can specify aditional variables and they get added to the object. intended behaviour? |
|||
