Skip to content

Allow default argument to be passed as keyword to os._Environ #15193

Closed

Description

@RasmusNygren

As of #15085, this code is invalid according to the typeshed stubs:

import os

os.environ.get("foo", default="bar")

Both mypy and ty now disallows this code despite it being valid at runtime.
main.py:3: error: No overload variant of "get" of "Mapping" matches argument types "str", "str" [call-overload]

At the very least I think os._Environ should have an overload to explicitly allow default to be passed as a keyword argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions