Skip to content

Commit

Permalink
Fix float resolver for '.' and '._'
Browse files Browse the repository at this point in the history
A single dot matches the official YAML 1.1 int regex.
This was probably unintended. The regex now requires at least
a digit before or after the dot.
  • Loading branch information
perlpunk committed Mar 26, 2021
1 parent 2112b10 commit 26fd944
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib3/yaml/resolver.py
Expand Up @@ -177,7 +177,7 @@ class Resolver(BaseResolver):
Resolver.add_implicit_resolver(
'tag:yaml.org,2002:float',
re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)?
|\.[0-9_]+(?:[eE][-+][0-9]+)?
|\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?
|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*
|[-+]?\.(?:inf|Inf|INF)
|\.(?:nan|NaN|NAN))$''', re.X),
Expand Down

0 comments on commit 26fd944

Please sign in to comment.