Ticket #219 (reopened defect)

Opened 2 years ago

Last modified 2 days ago

A tab inside a scalar is not accepted

Reported by: py4fun@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:


I got the exception when a tab character (\t) is located inside a scalar:

import yaml


This is the output of the latest source:

  File "C:\projects\py-workspace\pyyaml-trunk\lib\yaml\", line 143, in parse_implicit_document_start
  File "C:\projects\py-workspace\pyyaml-trunk\lib\yaml\", line 116, in check_token
  File "C:\projects\py-workspace\pyyaml-trunk\lib\yaml\", line 257, in fetch_more_tokens
    % ch.encode('utf-8'), self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token
  in "<string>", line 1, column 4:
    36L	DIESEL

When the tab character is replaced with a space, the parser works properly.

This issue was originally reported for SnakeYAML:


pyyaml-ticket-219.patch Download (1.1 KB) - added by py4fun@… 2 years ago.
Fix issue 219

Change History

comment:1 Changed 2 years ago by py4fun@…

I found the answer in

def scan_plain_spaces(self, indent, start_mark):
    # See the specification for details.
    # The specification is really confusing about tabs in plain scalars.
    # We just forbid them completely. Do not use tabs in YAML!

comment:2 Changed 2 years ago by anonymous

  • Status changed from new to closed
  • Resolution set to wontfix

comment:3 Changed 2 years ago by anonymous

  • Status changed from closed to reopened
  • Resolution wontfix deleted

I think PyYAML must allow tabs in plain scalar. I attach the patch with solution for Python 2.x

Changed 2 years ago by py4fun@…

Fix issue 219

comment:4 Changed 2 days ago by maskodok <galihadiputro87@…>

The only thing more I could hope for is documentation of all these features (other than reading through the code).  Cipto Junaedy Is this in process? Can I help? About  Unit Link Terbaik di Indonesia Commonwealth Life Investra Link


Add a comment

Modify Ticket

Change Properties
<Author field>
as reopened
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'

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

Note: See TracTickets for help on using tickets.