IndexError instead of ReaderError

Issue #232 resolved
Naomi Seyfer
created an issue
from ruamel import yaml
yaml.load(']')  # Raises IndexError

Traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/main.py", line 921, in load
    return loader._constructor.get_single_data()
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/constructor.py", line 106, in get_single_data
    node = self.composer.get_single_node()
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/composer.py", line 73, in get_single_node
    self.parser.get_event()
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/parser.py", line 163, in get_event
    self.current_event = self.state()
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/parser.py", line 177, in parse_stream_start
    token.move_comment(self.scanner.peek_token())
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/scanner.py", line 182, in peek_token
    self.fetch_more_tokens()
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/scanner.py", line 262, in fetch_more_tokens
    return self.fetch_flow_sequence_end()
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/scanner.py", line 524, in fetch_flow_sequence_end
    self.fetch_flow_collection_end(FlowSequenceEndToken, to_pop='[')
  File "/usr/local/google/home/seyfer/env/local/lib/python2.7/site-packages/ruamel/yaml/scanner.py", line 535, in fetch_flow_collection_end
    popped = self.flow_context.pop()
IndexError: pop from empty list

I think this should be ReaderError or some other carefully chosen one.

Comments (1)

  1. Log in to comment