Skip to content

Commit 33be43b

Browse files
committed
add contextlib.chdir
1 parent b3f29b6 commit 33be43b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: stdlib/contextlib.pyi

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from _typeshed import Self
2+
from _typeshed import Self, StrOrBytesPath
33
from types import TracebackType
44
from typing import (
55
IO,
@@ -124,3 +124,13 @@ elif sys.version_info >= (3, 7):
124124
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
125125
def __enter__(self) -> _T: ...
126126
def __exit__(self, *exctype: Any) -> None: ...
127+
128+
if sys.version_info >= (3, 11):
129+
_FdOrAnyPath = int | StrOrBytesPath
130+
_T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=_FdOrAnyPath)
131+
class chdir(AbstractContextManager[_T_fd_or_any_path]):
132+
path: _T_fd_or_any_path
133+
_old_cwd: list[str]
134+
def __init__(self, path: _FdOrAnyPath) -> None: ...
135+
def __enter__(self) -> None: ...
136+
def __exit__(self, *excinfo: Any) -> None: ...

0 commit comments

Comments
 (0)