From 7f0b3cfb5a5ee8d0dc74f584b23bc1f203ece5ac Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 18 Nov 2024 00:15:13 -0800 Subject: [PATCH 1/6] fix for os.path.splitroot on 3.13 --- stdlib/@tests/stubtest_allowlists/py313.txt | 1 - stdlib/posixpath.pyi | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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/posixpath.pyi b/stdlib/posixpath.pyi index 3313667f1781..5d75d5eee8ec 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): + @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 From 48a2fdce850ab145a0e505e5e62cef87c679984f Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 18 Nov 2024 00:21:02 -0800 Subject: [PATCH 2/6] ntpath version didn't change --- stdlib/ntpath.pyi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stdlib/ntpath.pyi b/stdlib/ntpath.pyi index ebe305ef708c..ab07fa370737 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 @@ -122,5 +122,11 @@ if sys.platform == "win32": else: realpath = abspath +if sys.version_info >= (3, 12): + @overload + def splitroot(path: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... + @overload + def splitroot(path: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ... + if sys.version_info >= (3, 13): def isreserved(path: StrOrBytesPath) -> bool: ... From 65268fd42872314c49ac970649d7ed24c92d5345 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 18 Nov 2024 00:22:55 -0800 Subject: [PATCH 3/6] copy/paste error --- stdlib/ntpath.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/ntpath.pyi b/stdlib/ntpath.pyi index ab07fa370737..7d4946dc53a0 100644 --- a/stdlib/ntpath.pyi +++ b/stdlib/ntpath.pyi @@ -124,9 +124,9 @@ else: if sys.version_info >= (3, 12): @overload - def splitroot(path: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... + def splitroot(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... @overload - def splitroot(path: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ... + def splitroot(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ... if sys.version_info >= (3, 13): def isreserved(path: StrOrBytesPath) -> bool: ... From 295f49a3242f08a1ab0f1c066a6ba71957938605 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 18 Nov 2024 00:25:58 -0800 Subject: [PATCH 4/6] stubtest --- stdlib/@tests/stubtest_allowlists/darwin-py313.txt | 2 -- stdlib/@tests/stubtest_allowlists/linux-py313.txt | 2 -- 2 files changed, 4 deletions(-) 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 From f52226d85cec1563aa1c86663cb26ce34390bc6d Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 18 Nov 2024 00:37:56 -0800 Subject: [PATCH 5/6] maybe this --- stdlib/ntpath.pyi | 10 ++-------- stdlib/posixpath.pyi | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/stdlib/ntpath.pyi b/stdlib/ntpath.pyi index 7d4946dc53a0..ebe305ef708c 100644 --- a/stdlib/ntpath.pyi +++ b/stdlib/ntpath.pyi @@ -1,5 +1,5 @@ import sys -from _typeshed import AnyOrLiteralStr, BytesPath, StrOrBytesPath, StrPath +from _typeshed import 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 + from posixpath import isjunction as isjunction, splitroot as splitroot if sys.version_info >= (3, 13): from genericpath import isdevdrive as isdevdrive @@ -122,11 +122,5 @@ if sys.platform == "win32": else: realpath = abspath -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]: ... - if sys.version_info >= (3, 13): def isreserved(path: StrOrBytesPath) -> bool: ... diff --git a/stdlib/posixpath.pyi b/stdlib/posixpath.pyi index 5d75d5eee8ec..abb1f25ba609 100644 --- a/stdlib/posixpath.pyi +++ b/stdlib/posixpath.pyi @@ -161,7 +161,7 @@ def lexists(path: FileDescriptorOrPath) -> bool: ... if sys.version_info >= (3, 12): def isjunction(path: StrOrBytesPath) -> bool: ... -if sys.version_info >= (3, 13): +if sys.version_info >= (3, 13) and sys.platform != "win32": @overload def splitroot(path: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... @overload From 182648d52a1181ff1b7773004c2961d5754290d8 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 18 Nov 2024 00:40:20 -0800 Subject: [PATCH 6/6] try again --- stdlib/ntpath.pyi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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]: ...