Skip to content

PyYAML: correct return type of construct_scalar()#12664

Merged
srittau merged 1 commit into
python:mainfrom
stevenlele:pyyaml
Sep 16, 2024
Merged

PyYAML: correct return type of construct_scalar()#12664
srittau merged 1 commit into
python:mainfrom
stevenlele:pyyaml

Conversation

@stevenlele

@stevenlele stevenlele commented Sep 15, 2024

Copy link
Copy Markdown
Contributor

This error was introduced in #4796.

You can verify that bool, int and others are constructed via the SafeConstructor.construct_yaml_*() methods and they all call self.construct_scalar(node) to get a string value. construct_scalar() just returns the node's value, which is a str.

This is found when adding stubs for ruamel.yaml in #12584. That PR is ready for review now. Please take a look at that too.

This PR only fixed this issue. I might port the detailed stubs to PyYAML after the ones for ruamel.yaml gets added.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit 2ccd254 into python:main Sep 16, 2024
@stevenlele stevenlele deleted the pyyaml branch September 16, 2024 07:12
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.

2 participants