Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue with PyYAML's load() #2886

Closed
nkantar opened this issue Mar 26, 2019 · 7 comments
Closed

Possible issue with PyYAML's load() #2886

nkantar opened this issue Mar 26, 2019 · 7 comments
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module

Comments

@nkantar
Copy link

nkantar commented Mar 26, 2019

I'm running into a confusing error when using mypy to check a project using PyYAML.

Relevant code:

raw = yaml.load(some_str, Loader=yaml.FullLoader)

Error message (from mypy --strict):

error: Call to untyped function "load" in typed context

Yet the typeshed has:

def load(stream: Union[str, IO[str]], Loader=...) -> Any: ...

Versions:
• OS: macOS 10.14.3
• Python: 3.7.2 (installed via Homebrew)
• Pipenv: 2018.11.26
• mypy: 0.670
• PyYAML: 5.1

(If this belongs in the mypy repo, I'm happy to move it.)

@JelleZijlstra
Copy link
Member

This might be because Loader is untyped in typeshed.

@srittau srittau added size-small stubs: incomplete Annotations or sub-modules missing from an existing package or module labels Jun 5, 2019
@adamtheturtle
Copy link
Contributor

This was fixed in #3035.

@srittau srittau closed this as completed Jul 2, 2019
@AMWJ
Copy link

AMWJ commented Sep 30, 2022

This doesn't appear resolved? #3035 adds no types to the load() method's Loader argument, so Loader's type remains Unknown.

It appears #1657 attempted to resolve this incorrectly, and #1695 reverted. I think this should be re-opened until load() and load_all() are typed.

@Akuli
Copy link
Collaborator

Akuli commented Oct 2, 2022

Feel free to submit a PR :)

@Akuli Akuli reopened this Oct 2, 2022
@adamtheturtle
Copy link
Contributor

Apologies for my mistake.

@Avasam
Copy link
Sponsor Collaborator

Avasam commented Feb 20, 2023

Is this fixed by #9752 ?

@AlexWaygood
Copy link
Member

Is this fixed by #9752 ?

Looks like it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module
Projects
None yet
Development

No branches or pull requests

8 participants