diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt index 0faf75d4eacc..e3dc35cad224 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt @@ -1,6 +1,4 @@ # new in py313 -posixpath.splitroot - # Depends on HAVE_NCURSESW and how we install CPython, # should be removed when 3.13 will be officially released: _?curses.unget_wch diff --git a/stdlib/@tests/stubtest_allowlists/linux-py313.txt b/stdlib/@tests/stubtest_allowlists/linux-py313.txt index e76c72d2ca32..e69de29bb2d1 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py313.txt @@ -1,2 +0,0 @@ -# TODO: triage these (new in py313) -posixpath.splitroot diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index 894f59c80ecd..2e7bd3df2101 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -4,7 +4,6 @@ # TODO: triage these new errors _tkinter.create -os.path.splitroot tkinter.Misc.after_info tkinter.Misc.busy tkinter.Misc.busy_cget diff --git a/stdlib/ntpath.pyi b/stdlib/ntpath.pyi index ebe305ef708c..daaa916ff238 100644 --- a/stdlib/ntpath.pyi +++ b/stdlib/ntpath.pyi @@ -1,5 +1,5 @@ import sys -from _typeshed import BytesPath, StrOrBytesPath, StrPath +from _typeshed import AnyOrLiteralStr, BytesPath, StrOrBytesPath, StrPath from genericpath import ( commonprefix as commonprefix, exists as exists, @@ -46,7 +46,7 @@ from typing import AnyStr, overload from typing_extensions import LiteralString if sys.version_info >= (3, 12): - from posixpath import isjunction as isjunction, splitroot as splitroot + from posixpath import isjunction as isjunction if sys.version_info >= (3, 13): from genericpath import isdevdrive as isdevdrive @@ -124,3 +124,9 @@ else: if sys.version_info >= (3, 13): def isreserved(path: StrOrBytesPath) -> bool: ... + +if sys.version_info >= (3, 12): + @overload + def splitroot(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... + @overload + def splitroot(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ... diff --git a/stdlib/posixpath.pyi b/stdlib/posixpath.pyi index 3313667f1781..abb1f25ba609 100644 --- a/stdlib/posixpath.pyi +++ b/stdlib/posixpath.pyi @@ -160,6 +160,14 @@ def lexists(path: FileDescriptorOrPath) -> bool: ... if sys.version_info >= (3, 12): def isjunction(path: StrOrBytesPath) -> bool: ... + +if sys.version_info >= (3, 13) and sys.platform != "win32": + @overload + def splitroot(path: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... + @overload + def splitroot(path: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ... + +elif sys.version_info >= (3, 12): @overload def splitroot(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... @overload