Ticket #62 (closed defect: fixed)
value token of single period ('.') is parsed incorrectly, throws wrong exception
| Reported by: | sproaticus | Owned by: | xi |
|---|---|---|---|
| Priority: | normal | Component: | pyyaml |
| Severity: | normal | Keywords: | ValueError, YAMLError |
| Cc: |
Description
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/__init__.py", line 66, in load
File "build/bdist.linux-i686/egg/yaml/constructor.py", line 38, in get_data
File "build/bdist.linux-i686/egg/yaml/constructor.py", line 46, in construct_document
File "build/bdist.linux-i686/egg/yaml/constructor.py", line 394, in construct_yaml_map
File "build/bdist.linux-i686/egg/yaml/constructor.py", line 207, in construct_mapping
File "build/bdist.linux-i686/egg/yaml/constructor.py", line 132, in construct_mapping
File "build/bdist.linux-i686/egg/yaml/constructor.py", line 87, in construct_object
File "build/bdist.linux-i686/egg/yaml/constructor.py", line 281, in construct_yaml_float
ValueError: invalid literal for float(): .
Environment:
- 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
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
