1. Kirill Simonov
  2. pyyaml


Kirill Simonov  committed 8f9ca0e

Raise an error for colons in the flow context.

  • Participants
  • Parent commits 7227184
  • Branches default

Comments (0)

Files changed (3)


View file
  • Ignore whitespace
-PyYAML3000 - The next generation YAML parser for Python.
+PyYAML 3000 - The next generation YAML parser and emitter for Python.
 To install, type 'python setup.py install'.
-For more information, check 'http://pyyaml.org/wiki/PyYAML'.
+For more information, check the PyYAML homepage:
 Post your questions and opinions to the YAML-Core mailing list:
-PyYAML3000 is written by Kirill Simonov <xi@resolvent.net>. It is released
+Submit bug reports and feature requests to the PyYAML bug tracker:
+PyYAML 3000 is written by Kirill Simonov <xi@resolvent.net>. It is released
 under the MIT license. See the file LICENSE for more details.

File lib/yaml/scanner.py

View file
  • Ignore whitespace
                         or (self.flow_level and ch in u',:?[]{}'):
                 length += 1
+            # It's not clear what we should do with ':' in the flow context.
+            if (self.flow_level and ch == u':'
+                    and self.peek(length+1) not in u'\0 \t\r\n\x28\u2028\u2029,[]{}'):
+                self.forward(length)
+                raise ScannerError("while scanning a plain scalar", start_mark,
+                    "found unexpected ':'", self.get_mark(),
+                    "Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.")
             if length == 0:
             self.allow_simple_key = False

File tests/data/colon-in-flow-context.loader-error

View file
  • Ignore whitespace
+{ foo:bar }