Skip to content

Upgrade to latest 3.12 and 3.13 versions for stubtest #12131

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

Merged
merged 7 commits into from
Jun 12, 2024
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
3 changes: 1 addition & 2 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/stubtest_stdlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"reportUnknownVariableType": "none",
// Extra strict settings
"reportCallInDefaultInitializer": "error",
"reportImplicitStringConcatenation": "error",
"reportUnnecessaryTypeIgnoreComment": "error",
// Leave "type: ignore" comments to mypy
"enableTypeIgnoreComments": false,
Expand Down
3 changes: 2 additions & 1 deletion pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions stdlib/@tests/stubtest_allowlists/darwin-py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,6 +26,7 @@ os.waitid_result
posix.grantpt
posix.posix_openpt
posix.ptsname
posixpath.splitroot
posix.unlockpt
posix.waitid
posix.waitid_result
Expand All @@ -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)?
Expand Down
2 changes: 2 additions & 0 deletions stdlib/@tests/stubtest_allowlists/darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
Expand Down
101 changes: 1 addition & 100 deletions stdlib/@tests/stubtest_allowlists/linux-py313.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# TODO: triage these (new in py313)
_decimal
_stat.SF_SETTABLE
_stat.SF_SUPPORTED
_stat.SF_SYNTHETIC
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
5 changes: 1 addition & 4 deletions stdlib/@tests/stubtest_allowlists/py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions stdlib/@tests/stubtest_allowlists/win32-py312.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions stdlib/@tests/stubtest_allowlists/win32-py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions stdlib/_curses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions stdlib/_tkinter.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
#
Expand Down Expand Up @@ -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: ...
Comment on lines +93 to +95
Copy link
Member Author

Choose a reason for hiding this comment

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

These were added in python/cpython@1ff626e


# These should be kept in sync with tkinter.tix constants, except ALL_EVENTS which doesn't match TCL_ALL_EVENTS
ALL_EVENTS: Literal[-3]
Expand Down
8 changes: 7 additions & 1 deletion stdlib/mmap.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions stdlib/telnetlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
23 changes: 21 additions & 2 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, ...],
*,
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, ...] = ...,
type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] | None = None,
*,
recursive_guard: frozenset[str],
) -> Any | None: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/shapely/shapely/geometry/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down Expand Up @@ -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]
Loading