Modify

Ticket #62 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

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

comment:1 Changed 7 years ago by xi

  • Status changed from new to assigned

Thanks for the report, i'll try to fix it shortly. I have no idea why PIL is mentioned in the traceback, but i've seen it before. My guess is that pyyaml triggers some bug in the traceback code.

comment:2 Changed 6 years ago by xi

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed in [260].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.