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

Update pathlib to 3.12 #10646

Merged
merged 4 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 15 additions & 3 deletions stdlib/pathlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from _typeshed import (
ReadableBuffer,
StrOrBytesPath,
StrPath,
Unused,
)
from collections.abc import Callable, Generator, Iterator, Sequence
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
Expand Down Expand Up @@ -38,7 +39,12 @@ class PurePath(PathLike[str]):
def suffixes(self) -> list[str]: ...
@property
def stem(self) -> str: ...
def __new__(cls, *args: StrPath) -> Self: ...
if sys.version_info >= (3, 12):
def __new__(cls, *args: StrPath, **kwargs: Unused) -> Self: ...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically *args are also unused in __new__, but I fear that using Unused here might break *args: StrPath in __init__. So, I went with the safest bet.

def __init__(self, *args: StrPath) -> None: ...
else:
def __new__(cls, *args: StrPath) -> Self: ...

def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __fspath__(self) -> str: ...
Expand All @@ -53,15 +59,21 @@ class PurePath(PathLike[str]):
def as_uri(self) -> str: ...
def is_absolute(self) -> bool: ...
def is_reserved(self) -> bool: ...
if sys.version_info >= (3, 9):
if sys.version_info >= (3, 12):
def is_relative_to(self, __other: StrPath, *_deprecated: StrPath) -> bool: ...
elif sys.version_info >= (3, 9):
def is_relative_to(self, *other: StrPath) -> bool: ...

if sys.version_info >= (3, 12):
def match(self, path_pattern: str, *, case_sensitive: bool | None = None) -> bool: ...
else:
def match(self, path_pattern: str) -> bool: ...

def relative_to(self, *other: StrPath) -> Self: ...
if sys.version_info >= (3, 12):
def relative_to(self, __other: StrPath, *_deprecated: StrPath, walk_up: bool = False) -> Self: ...
else:
def relative_to(self, *other: StrPath) -> Self: ...

def with_name(self, name: str) -> Self: ...
if sys.version_info >= (3, 9):
def with_stem(self, stem: str) -> Self: ...
Expand Down
4 changes: 0 additions & 4 deletions tests/stubtest_allowlists/py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ importlib.metadata._meta.PackageMetadata.get
importlib.metadata._meta.SimplePath.__truediv__
importlib.metadata._meta.SimplePath.parent
importlib.resources.files
pathlib.Path.__init__
pathlib.PurePath.__init__
pathlib.PurePath.is_relative_to
pathlib.PurePath.relative_to
poplib.POP3_SSL.__init__
smtplib.SMTP.starttls
smtplib.SMTP_SSL.__init__
Expand Down