Skip to content

Allow default as keyword arg to os.environ.{get,pop} - #15194

Merged
AlexWaygood merged 1 commit into
python:mainfrom
RasmusNygren:allow-default-keyword-for-environ
Dec 31, 2025
Merged

AlexWaygood merged 1 commit into
python:mainfrom
RasmusNygren:allow-default-keyword-for-environ

Conversation

@RasmusNygren

Copy link
Copy Markdown
Contributor

Fixes #15193

@github-actions

This comment has been minimized.

@RasmusNygren
RasmusNygren force-pushed the allow-default-keyword-for-environ branch from 8f62687 to e8d4cf7 Compare December 30, 2025 20:25
@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pyodide (https://github.com/pyodide/pyodide)
- pyodide-build/pyodide_build/xbuildenv_releases.py:220: error: No overload variant of "get" of "Mapping" matches argument types "str", "str"  [call-overload]
- pyodide-build/pyodide_build/xbuildenv_releases.py:220: note: Possible overload variants:
- pyodide-build/pyodide_build/xbuildenv_releases.py:220: note:     def get(self, str, /) -> str | None
- pyodide-build/pyodide_build/xbuildenv_releases.py:220: note:     def get(self, str, str, /) -> str
- pyodide-build/pyodide_build/xbuildenv_releases.py:220: note:     def [_T] get(self, str, _T, /) -> str | _T

@AlexWaygood

Copy link
Copy Markdown
Member

Thanks! It looks like all the other stdlib classes that override (Mutable)Mapping (weakref.WeakKeyDictionary, weakref.WeakValueDictionary, collections.ChainMap, collections.UserDict) already have these methods overridden

@AlexWaygood
AlexWaygood merged commit 9175667 into python:main Dec 31, 2025
63 checks passed
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.

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

2 participants