Skip to content

Commit 9c488d7

Browse files
authored
Merge branch 'main' into gh-149504
2 parents 558ece4 + 3cfc249 commit 9c488d7

104 files changed

Lines changed: 585 additions & 22017 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/mypy.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ jobs:
6969
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7070
with:
7171
persist-credentials: false
72-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
72+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
7373
with:
7474
python-version: "3.15"
75-
allow-prereleases: true
76-
cache: pip
77-
cache-dependency-path: Tools/requirements-dev.txt
78-
- run: pip install -r Tools/requirements-dev.txt
75+
activate-environment: true
76+
cache-dependency-glob: Tools/requirements-dev.txt
77+
- run: uv pip install -r Tools/requirements-dev.txt
7978
- run: python3 Misc/mypy/make_symlinks.py --symlink
80-
- run: mypy --config-file ${{ matrix.target }}/mypy.ini
79+
- run: mypy --num-workers 4 --config-file ${{ matrix.target }}/mypy.ini

.github/workflows/posix-deps-apt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ apt-get -yq --no-install-recommends install \
2727
zlib1g-dev
2828

2929
# Workaround missing libmpdec-dev on ubuntu 24.04 by building mpdecimal
30-
# from source. ppa:ondrej/php (launchpad.net) are unreliable
30+
# from source. ppa:ondrej/php (launchpad.net) are unreliable
3131
# (https://status.canonical.com) so fetch the tarball directly
3232
# from the upstream host.
3333
# https://www.bytereef.org/mpdecimal/

Doc/c-api/sentinel.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@ Sentinel objects
1414

1515
.. c:function:: int PySentinel_Check(PyObject *o)
1616
17-
Return true if *o* is a :class:`sentinel` object. The :class:`sentinel` type
18-
does not allow subclasses, so this check is exact.
17+
Return true if *o* is a :class:`sentinel` object or a subtype.
18+
The :class:`sentinel` type does not currently allow subclasses,
19+
so this check is exact.
20+
Future Python versions may choose to allow subtyping.
21+
This function always succeeds.
22+
23+
.. versionadded:: 3.15
24+
25+
.. c:function:: int PySentinel_CheckExact(PyObject *o)
26+
27+
Return true if *o* is a :class:`sentinel` object, but not a subtype.
28+
The :class:`sentinel` type does not currently allow subclasses.
29+
Future Python versions may choose to allow subtyping.
30+
This function always succeeds.
1931
2032
.. versionadded:: 3.15
2133

Doc/library/dataclasses.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ Module contents
498498
.. function:: is_dataclass(obj)
499499

500500
Return ``True`` if its parameter is a dataclass (including subclasses of a
501-
dataclass) or an instance of one, otherwise return ``False``.
501+
dataclass, but not including :ref:`generic aliases <types-genericalias>`)
502+
or an instance of one, otherwise return ``False``.
502503

503504
If you need to know if a class is an instance of a dataclass (and
504505
not a dataclass itself), then add a further check for ``not

Doc/library/inspect.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
416416
Return ``True`` if the object is a class, whether built-in or created in Python
417417
code.
418418

419+
This function returns ``False`` for :ref:`generic aliases <types-genericalias>` of classes,
420+
such as ``list[int]``.
421+
419422

420423
.. function:: ismethod(object)
421424

Doc/library/mimetypes.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,11 @@ than one MIME-type database; it provides an interface similar to the one of the
315315
When *strict* is ``True`` (the default), the mapping will be added to the
316316
official MIME types, otherwise to the non-standard ones.
317317

318-
.. deprecated-removed:: 3.14 3.16
319-
Invalid, undotted extensions will raise a
320-
:exc:`ValueError` in Python 3.16.
318+
.. deprecated:: 3.14
319+
*ext* values that do not start with ``'.'`` are deprecated.
320+
321+
.. versionchanged:: next
322+
*ext* now must start with ``'.'``. Otherwise :exc:`ValueError` is raised.
321323

322324

323325
.. _mimetypes-cli:

Doc/library/stdtypes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5858,7 +5858,8 @@ type and the :class:`bytes` data type:
58585858

58595859
``GenericAlias`` objects are instances of the class
58605860
:class:`types.GenericAlias`, which can also be used to create ``GenericAlias``
5861-
objects directly.
5861+
objects directly. Specializations of user-defined :ref:`generic classes <generic-classes>`
5862+
may not be instances of :class:`types.GenericAlias`, but they provide similar functionality.
58625863

58635864
.. describe:: T[X, Y, ...]
58645865

Doc/library/typing.rst

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,14 +3633,27 @@ Introspection helpers
36333633

36343634
Determine if a type is a :class:`Protocol`.
36353635

3636-
For example::
3636+
For example:
3637+
3638+
.. testcode::
36373639

36383640
class P(Protocol):
36393641
def a(self) -> str: ...
36403642
b: int
36413643

3642-
is_protocol(P) # => True
3643-
is_protocol(int) # => False
3644+
assert is_protocol(P)
3645+
assert not is_protocol(int)
3646+
3647+
This function only returns true for ``Protocol`` classes, not for
3648+
:ref:`generic aliases <types-genericalias>` of them:
3649+
3650+
.. testcode::
3651+
3652+
class GenericP[T](Protocol):
3653+
def a(self) -> T: ...
3654+
b: int
3655+
3656+
assert not is_protocol(GenericP[int])
36443657

36453658
.. versionadded:: 3.13
36463659

@@ -3663,6 +3676,17 @@ Introspection helpers
36633676
# not a typed dict itself
36643677
assert not is_typeddict(TypedDict)
36653678

3679+
This function only returns true for ``TypedDict`` classes, not for
3680+
:ref:`generic aliases <types-genericalias>` of them:
3681+
3682+
.. testcode::
3683+
3684+
class GenericFilm[T](TypedDict):
3685+
title: str
3686+
year: T
3687+
3688+
assert not is_typeddict(GenericFilm[int])
3689+
36663690
.. versionadded:: 3.10
36673691

36683692
.. class:: ForwardRef

Doc/tools/removed-ids.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ c-api/file.html: deprecated-api
66

77
library/asyncio-task.html: terminating-a-task-group
88

9+
# Removed libmpdec
10+
using/configure.html: cmdoption-with-system-libmpdec
11+
912
# Removed APIs
1013
library/symtable.html: symtable.Class.get_methods
11-
library/sys.html: sys._enablelegacywindowsfsencoding
14+
library/sys.html: sys._enablelegacywindowsfsencoding

Doc/using/configure.rst

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ Dependencies to build optional modules are:
112112

113113
.. [1] If *libmpdec* is not available, the :mod:`decimal` module will use
114114
a pure-Python implementation.
115-
See :option:`--with-system-libmpdec` for details.
116115
.. [2] See :option:`--with-readline` for choosing the backend for the
117116
:mod:`readline` module.
118117
.. [3] The :mod:`uuid` module uses ``_uuid`` to generate "safe" UUIDs.
@@ -553,11 +552,6 @@ Options for third-party dependencies
553552
C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module,
554553
overriding ``pkg-config``.
555554

556-
.. note::
557-
558-
These environment variables have no effect unless
559-
:option:`--with-system-libmpdec` is specified.
560-
561555
.. option:: LIBLZMA_CFLAGS
562556
.. option:: LIBLZMA_LIBS
563557

@@ -1067,29 +1061,6 @@ Libraries options
10671061
Build the :mod:`!pyexpat` module using an installed ``expat`` library
10681062
(default is no).
10691063

1070-
.. option:: --with-system-libmpdec
1071-
1072-
Build the ``_decimal`` extension module using an installed ``mpdecimal``
1073-
library, see the :mod:`decimal` module (default is yes).
1074-
1075-
.. versionadded:: 3.3
1076-
1077-
.. versionchanged:: 3.13
1078-
Default to using the installed ``mpdecimal`` library.
1079-
1080-
.. versionchanged:: 3.15
1081-
1082-
A bundled copy of the library will no longer be selected
1083-
implicitly if an installed ``mpdecimal`` library is not found.
1084-
In Python 3.15 only, it can still be selected explicitly using
1085-
``--with-system-libmpdec=no`` or ``--without-system-libmpdec``.
1086-
1087-
.. deprecated-removed:: 3.13 3.16
1088-
A copy of the ``mpdecimal`` library sources will no longer be distributed
1089-
with Python 3.16.
1090-
1091-
.. seealso:: :option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`.
1092-
10931064
.. option:: --with-readline=readline|editline
10941065

10951066
Designate a backend library for the :mod:`readline` module.

0 commit comments

Comments
 (0)