From 7784c56e11b98b7eaec99364079d4e74db56ccb7 Mon Sep 17 00:00:00 2001 From: Joseph Young <80432516+jpy-git@users.noreply.github.com> Date: Thu, 6 Jan 2022 22:30:31 +0000 Subject: [PATCH] Accept bytes paths in shutil.copyfile (#6841) --- stdlib/shutil.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index d2bc50ecd..a691cba20 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -3,7 +3,7 @@ import sys from _typeshed import StrOrBytesPath, StrPath, SupportsRead, SupportsWrite from typing import Any, AnyStr, Callable, Iterable, NamedTuple, Sequence, TypeVar, Union, overload -_PathT = TypeVar("_PathT", str, os.PathLike[str]) +_PathT = TypeVar("_PathT", str, bytes, os.PathLike[str], os.PathLike[bytes]) # Return value of some functions that may either return a path-like object that was passed in or # a string _PathReturn = Any @@ -16,7 +16,7 @@ class ReadError(OSError): ... class RegistryError(Exception): ... def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ... -def copyfile(src: StrPath, dst: _PathT, *, follow_symlinks: bool = ...) -> _PathT: ... +def copyfile(src: StrOrBytesPath, dst: _PathT, *, follow_symlinks: bool = ...) -> _PathT: ... def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ... def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ... def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...