Select Git revision
-
Tristan Van Berkom authored
This allows specifying whether or not the code believes a None value is acceptable if explicitly expressed to be None in the YAML. A previous patch 3ba544b8 changed the behavior to accept None for all values across the board, along with allowing explicitly setting the `default_value` to `None` which caused the code to be much more readable (this was the main motivation of the patch, but it had the side effect of allowing None for everything). In the majority of cases we load YAML however, it either has a value or it is not specified in the YAML, and None is hardly ever acceptable to be explicitly specified (it may be in the case you want to override something with nothing in the YAML, but it is the edge case). This had the side effect of causing unexpected crashes where the YAML specifies an empty dictionary for instance. Instead of forcing the caller to handle a possible None value, give the choice to the caller if they really want to accept a None value, and raise the LoadError otherwise. This fixes issue #803, which is a crash due to receival of an unexpected None value through _yaml.node_get()
Tristan Van Berkom authoredThis allows specifying whether or not the code believes a None value is acceptable if explicitly expressed to be None in the YAML. A previous patch 3ba544b8 changed the behavior to accept None for all values across the board, along with allowing explicitly setting the `default_value` to `None` which caused the code to be much more readable (this was the main motivation of the patch, but it had the side effect of allowing None for everything). In the majority of cases we load YAML however, it either has a value or it is not specified in the YAML, and None is hardly ever acceptable to be explicitly specified (it may be in the case you want to override something with nothing in the YAML, but it is the edge case). This had the side effect of causing unexpected crashes where the YAML specifies an empty dictionary for instance. Instead of forcing the caller to handle a possible None value, give the choice to the caller if they really want to accept a None value, and raise the LoadError otherwise. This fixes issue #803, which is a crash due to receival of an unexpected None value through _yaml.node_get()
_yaml.py 39.77 KiB