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

add contextlib.chdir #6191

Merged
merged 7 commits into from
Nov 8, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion stdlib/contextlib.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from _typeshed import Self
from _typeshed import Self, StrOrBytesPath
from types import TracebackType
from typing import (
IO,
Expand Down Expand Up @@ -124,3 +124,12 @@ elif sys.version_info >= (3, 7):
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: Any) -> None: ...

if sys.version_info >= (3, 11):
_T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=int | StrOrBytesPath)
class chdir(AbstractContextManager[_T_fd_or_any_path]):
graingert marked this conversation as resolved.
Show resolved Hide resolved
Akuli marked this conversation as resolved.
Show resolved Hide resolved
path: _T_fd_or_any_path
_old_cwd: list[str]
graingert marked this conversation as resolved.
Show resolved Hide resolved
graingert marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self, path: _T_fd_or_any_path) -> None: ...
def __enter__(self) -> None: ...
graingert marked this conversation as resolved.
Show resolved Hide resolved
def __exit__(self, *excinfo: Any) -> None: ...
graingert marked this conversation as resolved.
Show resolved Hide resolved