Skip to content

call-overload error on environ.pop("…", default="…") #11831

Closed
python/typeshed
#6694
@l0b0

Description

@l0b0

Bug Report

It's all in the title.

As far as I can tell it's not a duplicate of #10152, because I'm not dealing with TypeVars, or #3750, because I'm not doing any overloading myself.

To Reproduce

$ mypy --strict <(echo 'from os import environ; environ.pop("…", default="…")')
/dev/fd/63:1: error: No overload variant of "pop" of "MutableMapping" matches argument types "str", "str"  [call-overload]
/dev/fd/63:1: note: Possible overload variants:
/dev/fd/63:1: note:     def pop(self, str) -> str
/dev/fd/63:1: note:     def [_T] pop(self, str, Union[str, _T] = ...) -> Union[str, _T]
Found 1 error in 1 file (checked 1 source file)

Expected Behavior

This should succeed. This is a regression since 0.910.

Your Environment

  • Mypy version used: 0.930
  • Mypy command-line flags: --strict
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.8.12
  • Operating system and version: NixOS 21.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions