diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index d8ce41b7a..6d389c57d 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -36,8 +36,7 @@ jobs: matrix: # various modules aren't available on macos-13 and higher os: ["ubuntu-latest", "windows-latest", "macos-12"] - # TODO: unpin 3.12 and 3.13 micro versions once https://github.com/actions/setup-python/issues/886 is resolved - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.3", "3.13.0-beta.1"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] fail-fast: false steps: diff --git a/.github/workflows/stubtest_stdlib.yml b/.github/workflows/stubtest_stdlib.yml index 12dbd5402..c094f8c0f 100644 --- a/.github/workflows/stubtest_stdlib.yml +++ b/.github/workflows/stubtest_stdlib.yml @@ -32,8 +32,7 @@ jobs: matrix: # various modules aren't available on macos-13 and higher os: ["ubuntu-latest", "windows-latest", "macos-12"] - # TODO: unpin 3.12 and 3.13 micro versions once https://github.com/actions/setup-python/issues/886 is resolved - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.3", "3.13.0-beta.1"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] fail-fast: false steps: diff --git a/pyrightconfig.json b/pyrightconfig.json index d4fd646c7..0a538cde7 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -18,7 +18,6 @@ "reportUnknownVariableType": "none", // Extra strict settings "reportCallInDefaultInitializer": "error", - "reportImplicitStringConcatenation": "error", "reportUnnecessaryTypeIgnoreComment": "error", // Leave "type: ignore" comments to mypy "enableTypeIgnoreComments": false, diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 1a16a0fd0..db1635a48 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -105,7 +105,8 @@ "reportIncompleteStub": "none", // Extra strict settings "reportCallInDefaultInitializer": "error", - "reportImplicitStringConcatenation": "error", + // implicit string concatenation is useful for long deprecation messages + "reportImplicitStringConcatenation": "none", "reportUnnecessaryTypeIgnoreComment": "error", // Leave "type: ignore" comments to mypy "enableTypeIgnoreComments": false, diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt index 6d0ca9920..c9bfa2d8d 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt @@ -3,6 +3,9 @@ asyncio.unix_events.EventLoop asyncio.unix_events._UnixSelectorEventLoop.create_unix_server asyncio.unix_events.__all__ fcntl.F_GETNOSIGPIPE +fcntl.F_OFD_GETLK +fcntl.F_OFD_SETLK +fcntl.F_OFD_SETLKW fcntl.F_RDAHEAD fcntl.F_SETNOSIGPIPE mmap.MAP_HASSEMAPHORE @@ -23,6 +26,7 @@ os.waitid_result posix.grantpt posix.posix_openpt posix.ptsname +posixpath.splitroot posix.unlockpt posix.waitid posix.waitid_result @@ -34,6 +38,9 @@ _curses.unget_wch _curses.window.get_wch curses.window.get_wch +# Exists locally on MacOS but not on GitHub +(mmap.MAP_32BIT)? + # These entries looks like a `setup-python` bug: (dbm.gnu)? (_?locale.bind_textdomain_codeset)? diff --git a/stdlib/@tests/stubtest_allowlists/darwin.txt b/stdlib/@tests/stubtest_allowlists/darwin.txt index 77cdd5f35..c7398456d 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin.txt @@ -6,6 +6,8 @@ select.kqueue.__init__ # default C signature is wrong select.POLLMSG # system dependent # Sometimes these seem to exist on darwin, sometimes not +(_curses.A_ITALIC)? +(curses.A_ITALIC)? (_socket.MSG_NOSIGNAL)? (socket.MsgFlag.MSG_NOSIGNAL)? (socket.MSG_NOSIGNAL)? diff --git a/stdlib/@tests/stubtest_allowlists/linux-py313.txt b/stdlib/@tests/stubtest_allowlists/linux-py313.txt index 4f87be5b4..365e2626a 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py313.txt @@ -1,5 +1,4 @@ # TODO: triage these (new in py313) -_decimal _stat.SF_SETTABLE _stat.SF_SUPPORTED _stat.SF_SYNTHETIC @@ -22,7 +21,6 @@ fcntl.RWH_WRITE_LIFE_MEDIUM fcntl.RWH_WRITE_LIFE_NONE fcntl.RWH_WRITE_LIFE_NOT_SET fcntl.RWH_WRITE_LIFE_SHORT -mmap.MAP_32BIT mmap.MAP_NORESERVE os.POSIX_SPAWN_CLOSEFROM os.TFD_CLOEXEC @@ -46,6 +44,7 @@ posix.TFD_TIMER_CANCEL_ON_SET posix.grantpt posix.posix_openpt posix.ptsname +posixpath.splitroot posix.timerfd_create posix.timerfd_gettime posix.timerfd_gettime_ns @@ -62,104 +61,6 @@ syslog.LOG_NETINFO syslog.LOG_RAS syslog.LOG_REMOTEAUTH -# Python 3.13.0b2 will use the _decimal C extension and this will be resolved. https://github.com/python/typeshed/pull/12061#issuecomment-2139352738 -decimal.Context.abs -decimal.Context.add -decimal.Context.canonical -decimal.Context.compare -decimal.Context.compare_signal -decimal.Context.compare_total -decimal.Context.compare_total_mag -decimal.Context.copy_abs -decimal.Context.copy_decimal -decimal.Context.copy_negate -decimal.Context.copy_sign -decimal.Context.create_decimal -decimal.Context.create_decimal_from_float -decimal.Context.divide -decimal.Context.divide_int -decimal.Context.divmod -decimal.Context.exp -decimal.Context.fma -decimal.Context.is_canonical -decimal.Context.is_finite -decimal.Context.is_infinite -decimal.Context.is_nan -decimal.Context.is_normal -decimal.Context.is_qnan -decimal.Context.is_signed -decimal.Context.is_snan -decimal.Context.is_subnormal -decimal.Context.is_zero -decimal.Context.ln -decimal.Context.log10 -decimal.Context.logb -decimal.Context.logical_and -decimal.Context.logical_invert -decimal.Context.logical_or -decimal.Context.logical_xor -decimal.Context.max -decimal.Context.max_mag -decimal.Context.min -decimal.Context.min_mag -decimal.Context.minus -decimal.Context.multiply -decimal.Context.next_minus -decimal.Context.next_plus -decimal.Context.next_toward -decimal.Context.normalize -decimal.Context.number_class -decimal.Context.plus -decimal.Context.quantize -decimal.Context.remainder -decimal.Context.remainder_near -decimal.Context.rotate -decimal.Context.same_quantum -decimal.Context.scaleb -decimal.Context.shift -decimal.Context.sqrt -decimal.Context.subtract -decimal.Context.to_eng_string -decimal.Context.to_integral -decimal.Context.to_integral_exact -decimal.Context.to_integral_value -decimal.Context.to_sci_string -decimal.ConversionSyntax.handle -decimal.Decimal.__abs__ -decimal.Decimal.__add__ -decimal.Decimal.__divmod__ -decimal.Decimal.__eq__ -decimal.Decimal.__floordiv__ -decimal.Decimal.__ge__ -decimal.Decimal.__gt__ -decimal.Decimal.__le__ -decimal.Decimal.__lt__ -decimal.Decimal.__mod__ -decimal.Decimal.__mul__ -decimal.Decimal.__neg__ -decimal.Decimal.__pos__ -decimal.Decimal.__pow__ -decimal.Decimal.__radd__ -decimal.Decimal.__rdivmod__ -decimal.Decimal.__rfloordiv__ -decimal.Decimal.__rmod__ -decimal.Decimal.__rmul__ -decimal.Decimal.__round__ -decimal.Decimal.__rsub__ -decimal.Decimal.__rtruediv__ -decimal.Decimal.__str__ -decimal.Decimal.__sub__ -decimal.Decimal.__truediv__ -decimal.Decimal.from_float -decimal.DecimalException.handle -decimal.DivisionByZero.handle -decimal.DivisionImpossible.handle -decimal.DivisionUndefined.handle -decimal.InvalidContext.handle -decimal.InvalidOperation.handle -decimal.Overflow.handle -decimal.setcontext - # Exists on some Linux builds, and is documented, # but is unavailable in Github Actions on Linux with Python 3.12 (os|posix).CLONE_NEWTIME diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index 876800c00..6bf48be41 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -15,8 +15,6 @@ _thread.lock _thread.stack_size _thread.start_joinable_thread _thread.start_new_thread -_tkinter.TkappType.gettrace -_tkinter.TkappType.settrace _tkinter.create asyncio.AbstractEventLoop.create_server asyncio.AbstractServer.abort_clients @@ -110,6 +108,7 @@ mailbox.Maildir.get_info mailbox.Maildir.remove_flag mailbox.Maildir.set_flags mailbox.Maildir.set_info +os.path.splitroot pdb.Pdb.MAX_CHAINED_EXCEPTION_DEPTH pdb.Pdb.completedefault pdb.Pdb.completenames @@ -158,7 +157,6 @@ tkinter.Text.count tkinter.Wm.wm_attributes tkinter.tix trace.CoverageResults.write_results -traceback.StackSummary.should_show_carets # https://github.com/python/cpython/pull/112670#discussion_r1613952301 turtle.RawTurtle.settiltangle turtle.__all__ turtle.settiltangle @@ -260,7 +258,6 @@ _weakref.ProxyType.__reversed__ # Doesn't really exist argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group # deprecated, forwards arguments to super ast.ImportFrom.level # None on the class, but never None on instances builtins.property.__set_name__ # Doesn't actually exist -builtins.str.format_map # stubtest says `mapping` is pos-or-keyword but in reality it is pos-only collections\.UserList\.index # ignoring pos-or-keyword parameter dataclasses.KW_ONLY # white lies around defaults enum.auto.__init__ # The stub for enum.auto is nothing like the implementation diff --git a/stdlib/@tests/stubtest_allowlists/win32-py312.txt b/stdlib/@tests/stubtest_allowlists/win32-py312.txt index c8a6b5b48..86f1c28d0 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py312.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py312.txt @@ -1,3 +1,8 @@ +_winapi.GetLongPathName +_winapi.GetShortPathName +ntpath.exists +os.path.exists + # Undocumented internal method, not really for public consumption. # (Hard to add types for unless we add stubs for the undocumented _overlapped module...) asyncio.IocpProactor.finish_socket_func diff --git a/stdlib/@tests/stubtest_allowlists/win32-py313.txt b/stdlib/@tests/stubtest_allowlists/win32-py313.txt index e970988c5..baa538716 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py313.txt @@ -31,8 +31,13 @@ ctypes._endian.oledll ctypes._endian.windll nt.fchmod nt.lchmod +ntpath.exists +ntpath.lexists +ntpath.splitroot os.fchmod os.lchmod +os.path.exists +os.path.lexists stat.SF_SETTABLE stat.SF_SUPPORTED stat.SF_SYNTHETIC diff --git a/stdlib/_curses.pyi b/stdlib/_curses.pyi index 6f3fbd807..eb1d7b9bd 100644 --- a/stdlib/_curses.pyi +++ b/stdlib/_curses.pyi @@ -63,8 +63,7 @@ A_COLOR: int A_DIM: int A_HORIZONTAL: int A_INVIS: int -if sys.platform != "darwin": - A_ITALIC: int +A_ITALIC: int A_LEFT: int A_LOW: int A_NORMAL: int diff --git a/stdlib/_tkinter.pyi b/stdlib/_tkinter.pyi index 3340df424..aea74c8be 100644 --- a/stdlib/_tkinter.pyi +++ b/stdlib/_tkinter.pyi @@ -1,5 +1,7 @@ import sys +from collections.abc import Callable from typing import Any, ClassVar, Literal, final +from typing_extensions import TypeAlias # _tkinter is meant to be only used internally by tkinter, but some tkinter # functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl @@ -30,6 +32,8 @@ class Tcl_Obj: class TclError(Exception): ... +_TkinterTraceFunc: TypeAlias = Callable[[tuple[str, ...]], object] + # This class allows running Tcl code. Tkinter uses it internally a lot, and # it's often handy to drop a piece of Tcl code into a tkinter program. Example: # @@ -86,6 +90,9 @@ class TkappType: def unsetvar(self, *args, **kwargs): ... def wantobjects(self, *args, **kwargs): ... def willdispatch(self): ... + if sys.version_info >= (3, 12): + def gettrace(self, /) -> _TkinterTraceFunc | None: ... + def settrace(self, func: _TkinterTraceFunc | None, /) -> None: ... # These should be kept in sync with tkinter.tix constants, except ALL_EVENTS which doesn't match TCL_ALL_EVENTS ALL_EVENTS: Literal[-3] diff --git a/stdlib/mmap.pyi b/stdlib/mmap.pyi index 2d27e7b2a..7688970e5 100644 --- a/stdlib/mmap.pyi +++ b/stdlib/mmap.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import ReadableBuffer, Unused from collections.abc import Iterable, Iterator, Sized -from typing import NoReturn, overload +from typing import Final, NoReturn, overload from typing_extensions import Self ACCESS_DEFAULT: int @@ -113,3 +113,9 @@ if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win if sys.version_info >= (3, 10) and sys.platform == "darwin": MADV_FREE_REUSABLE: int MADV_FREE_REUSE: int + +if sys.version_info >= (3, 13) and sys.platform != "win32": + MAP_32BIT: Final = 32768 + +if sys.version_info >= (3, 13) and sys.platform == "darwin": + MAP_TPRO: Final = 524288 diff --git a/stdlib/telnetlib.pyi b/stdlib/telnetlib.pyi index d244d54f2..294a1cb12 100644 --- a/stdlib/telnetlib.pyi +++ b/stdlib/telnetlib.pyi @@ -88,6 +88,7 @@ NOOPT: bytes class Telnet: host: str | None # undocumented + sock: socket.socket | None # undocumented def __init__(self, host: str | None = None, port: int = 0, timeout: float = ...) -> None: ... def open(self, host: str, port: int = 0, timeout: float = ...) -> None: ... def msg(self, msg: str, *args: Any) -> None: ... diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index f04b2d858..92427f91f 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -21,7 +21,7 @@ from types import ( TracebackType, WrapperDescriptorType, ) -from typing_extensions import Never as _Never, ParamSpec as _ParamSpec +from typing_extensions import Never as _Never, ParamSpec as _ParamSpec, deprecated if sys.version_info >= (3, 9): from types import GenericAlias @@ -991,11 +991,30 @@ class ForwardRef: def __init__(self, arg: str, is_argument: bool = True) -> None: ... if sys.version_info >= (3, 13): + @overload + @deprecated( + "Failing to pass a value to the 'type_params' parameter of ForwardRef._evaluate() is deprecated, " + "as it leads to incorrect behaviour when evaluating a stringified annotation " + "that references a PEP 695 type parameter. It will be disallowed in Python 3.15." + ) + def _evaluate( + self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None, *, recursive_guard: frozenset[str] + ) -> Any | None: ... + @overload def _evaluate( self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None, - type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ..., + type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...], + *, + recursive_guard: frozenset[str], + ) -> Any | None: ... + elif sys.version_info >= (3, 12): + def _evaluate( + self, + globalns: dict[str, Any] | None, + localns: dict[str, Any] | None, + type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] | None = None, *, recursive_guard: frozenset[str], ) -> Any | None: ... diff --git a/stubs/shapely/shapely/geometry/base.pyi b/stubs/shapely/shapely/geometry/base.pyi index 05caa6632..ac8b1ca31 100644 --- a/stubs/shapely/shapely/geometry/base.pyi +++ b/stubs/shapely/shapely/geometry/base.pyi @@ -33,7 +33,7 @@ class JOIN_STYLE: class BaseGeometry(Geometry): @deprecated( "Directly calling 'BaseGeometry()' is deprecated. To create an empty geometry, " - "use one of the subclasses instead, for example 'GeometryCollection()'." # pyright: ignore[reportImplicitStringConcatenation] + "use one of the subclasses instead, for example 'GeometryCollection()'." ) def __new__(self) -> GeometryCollection: ... def __bool__(self) -> bool: ... @@ -280,6 +280,6 @@ class GeometrySequence(Generic[_P_co]): class EmptyGeometry(BaseGeometry): @deprecated( "The 'EmptyGeometry()' constructor is deprecated. Use one of the " - "geometry subclasses instead, for example 'GeometryCollection()'." # pyright: ignore[reportImplicitStringConcatenation] + "geometry subclasses instead, for example 'GeometryCollection()'." ) def __new__(self) -> GeometryCollection: ... # type: ignore[misc]