mirror of
https://gitee.com/openharmony/third_party_pyyaml
synced 2024-11-26 20:00:35 +00:00
Fix float resolver for '.' and '._'
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.
This commit is contained in:
parent
575d2f46db
commit
8f27932796
@ -177,7 +177,7 @@ Resolver.add_implicit_resolver(
|
||||
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),
|
||||
|
@ -1,8 +1,6 @@
|
||||
load: {
|
||||
'Y': 1, 'y': 1, 'N': 1, 'n': 1,
|
||||
'!!bool Y': 1, '!!bool N': 1, '!!bool n': 1, '!!bool y': 1,
|
||||
'._', '!!str ._',
|
||||
'._14', '!!str ._14'
|
||||
}
|
||||
dump: {
|
||||
'!!str N': 1, '!!str Y': 1, '!!str n': 1, '!!str y': 1,
|
||||
|
Loading…
Reference in New Issue
Block a user