Skip to content

Fix yaml11 float resolver for '.'#497

Merged
ingydotnet merged 1 commit intoyaml:release/6.0from
perlpunk:fix-yaml11-float
Sep 23, 2021
Merged

Fix yaml11 float resolver for '.'#497
ingydotnet merged 1 commit intoyaml:release/6.0from
perlpunk:fix-yaml11-float

Conversation

@perlpunk
Copy link
Copy Markdown
Member

@perlpunk perlpunk commented Feb 6, 2021

This depends on #483.

Fixes #168
(see also #473 )

._ and . will now be loaded as strings.

The spec says that any digit is optional:
https://yaml.org/type/float.html

But we assume that this was not intended, so now at least one digit is required before and after the dot.

@perlpunk perlpunk mentioned this pull request Feb 6, 2021
@perlpunk
Copy link
Copy Markdown
Member Author

perlpunk commented Feb 6, 2021

Note that this might break things like ansible playbooks, where one could have directory entries like /, ..
We might also keep the behaviour, and change ._ to loading as a string too.
But we should still ensure that ._ and . are quoted when dumping, so that correct implementations don't load them as floats.

@perlpunk
Copy link
Copy Markdown
Member Author

I rewrote the fix and updated the test data and the description.

@tongxiaoge1001
Copy link
Copy Markdown

I rewrote the fix and updated the test data and the description.

Is this patch effective? I found that the communities were not merged.@perlpunk

@perlpunk perlpunk changed the base branch from master to release/6.0 September 22, 2021 22:36
@perlpunk perlpunk marked this pull request as ready for review September 22, 2021 22:36
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.
@ingydotnet ingydotnet merged commit 216acbe into yaml:release/6.0 Sep 23, 2021
stuhood pushed a commit to pantsbuild/pants that referenced this pull request Oct 20, 2021
PyYAML 6:
```
6.0 (2021-10-13)

* yaml/pyyaml#327 -- Change README format to Markdown
* yaml/pyyaml#483 -- Add a test for YAML 1.1 types
* yaml/pyyaml#497 -- fix float resolver to ignore `.` and `._`
* yaml/pyyaml#550 -- drop Python 2.7
* yaml/pyyaml#553 -- Fix spelling of “hexadecimal”
* yaml/pyyaml#556 -- fix representation of Enum subclasses
* yaml/pyyaml#557 -- fix libyaml extension compiler warnings
* yaml/pyyaml#560 -- fix ResourceWarning on leaked file descriptors
* yaml/pyyaml#561 -- always require `Loader` arg to `yaml.load()`
* yaml/pyyaml#564 -- remove remaining direct distutils usage
```
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Oct 23, 2021
Now uses "vendored" distutils from setuptools by default
rather than from Python stdlib.

Changes
=======

* yaml/pyyaml#327
  -- Change README format to Markdown
* yaml/pyyaml#483
  -- Add a test for YAML 1.1 types
* yaml/pyyaml#497
  -- fix float resolver to ignore `.` and `._`
* yaml/pyyaml#550
  -- drop Python 2.7
* yaml/pyyaml#553
  -- Fix spelling of “hexadecimal”
* yaml/pyyaml#556
  -- fix representation of Enum subclasses
* yaml/pyyaml#557
  -- fix libyaml extension compiler warnings
* yaml/pyyaml#560
  -- fix ResourceWarning on leaked file descriptors
* yaml/pyyaml#561
  -- always require `Loader` arg to `yaml.load()`
* yaml/pyyaml#564
  -- remove remaining direct distutils usage

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
seambot pushed a commit to seamapi/poky that referenced this pull request Oct 23, 2021
Now uses "vendored" distutils from setuptools by default
rather than from Python stdlib.

Changes
=======

* yaml/pyyaml#327
  -- Change README format to Markdown
* yaml/pyyaml#483
  -- Add a test for YAML 1.1 types
* yaml/pyyaml#497
  -- fix float resolver to ignore `.` and `._`
* yaml/pyyaml#550
  -- drop Python 2.7
* yaml/pyyaml#553
  -- Fix spelling of “hexadecimal”
* yaml/pyyaml#556
  -- fix representation of Enum subclasses
* yaml/pyyaml#557
  -- fix libyaml extension compiler warnings
* yaml/pyyaml#560
  -- fix ResourceWarning on leaked file descriptors
* yaml/pyyaml#561
  -- always require `Loader` arg to `yaml.load()`
* yaml/pyyaml#564
  -- remove remaining direct distutils usage

(From OE-Core rev: 2abc7a612a71b3594f3183fbb824a708269ae694)

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValueError on "._" input

4 participants