Skip to content

PyYAML interprets yes, no, on, off as Boolean #613

Closed
@sergio-nsk

Description

@sergio-nsk

How to disable this behavior?
10.2.1.2. Boolean

Canonical Form

Either true or false.

What is a reason of such behavior? The valid YAML

bool: [true, false, on, off, yes, no]

is converted to the invalid dictionary

{'bool': [True, False, True, False, True, False]}

but expected to be converted to the dictionary

{'bool': [True, False, 'on', 'off', 'yes', 'no']}

The similar invalid behavior, the YAML

true: 1
false: 0
on: 1
off: 0
yes: 1
no: 0

results in the invalid dictionary

{True: 1, False: 0}

but expected

{True: 1, False: 0, 'on': 1, 'off': 0, 'yes': 1, 'no': 0}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions