Skip to content

Commit 8ffdc16

Browse files
Merge branch 'python:main' into patch-4
2 parents e369b59 + 543f56f commit 8ffdc16

File tree

15 files changed

+119
-104
lines changed

15 files changed

+119
-104
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ jobs:
261261
# Keep 1.1.1w in our list despite it being upstream EOL and otherwise
262262
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
263263
# supported by important vendors such as AWS-LC.
264-
openssl_ver: [1.1.1w, 3.0.18, 3.3.5, 3.4.3, 3.5.4, 3.6.0]
264+
openssl_ver: [1.1.1w, 3.0.19, 3.3.6, 3.4.4, 3.5.5, 3.6.1]
265265
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
266266
env:
267267
OPENSSL_VER: ${{ matrix.openssl_ver }}

Doc/howto/enum.rst

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -965,75 +965,16 @@ want one of them to be the value::
965965

966966

967967
Finer Points
968-
^^^^^^^^^^^^
969-
970-
Supported ``__dunder__`` names
971-
""""""""""""""""""""""""""""""
972-
973-
:attr:`~enum.EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member``
974-
items. It is only available on the class.
975-
976-
:meth:`~object.__new__`, if specified, must create and return the enum members; it is
977-
also a very good idea to set the member's :attr:`~Enum._value_` appropriately. Once
978-
all the members are created it is no longer used.
979-
980-
981-
Supported ``_sunder_`` names
982-
""""""""""""""""""""""""""""
968+
------------
983969

984-
- :attr:`~Enum._name_` -- name of the member
985-
- :attr:`~Enum._value_` -- value of the member; can be set in ``__new__``
986-
- :meth:`~Enum._missing_` -- a lookup function used when a value is not found;
987-
may be overridden
988-
- :attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a
989-
:class:`str`, that will not be transformed into members, and will be removed
990-
from the final class
991-
- :meth:`~Enum._generate_next_value_` -- used to get an appropriate value for
992-
an enum member; may be overridden
993-
- :meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing
994-
member.
995-
- :meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an
996-
existing member. See `MultiValueEnum`_ for an example.
970+
Supported ``__dunder__`` and ``_sunder_`` names
971+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
997972

998-
.. note::
999-
1000-
For standard :class:`Enum` classes the next value chosen is the highest
1001-
value seen incremented by one.
1002-
1003-
For :class:`Flag` classes the next value chosen will be the next highest
1004-
power-of-two.
1005-
1006-
.. versionchanged:: 3.13
1007-
Prior versions would use the last seen value instead of the highest value.
1008-
1009-
.. versionadded:: 3.6 ``_missing_``, ``_order_``, ``_generate_next_value_``
1010-
.. versionadded:: 3.7 ``_ignore_``
1011-
.. versionadded:: 3.13 ``_add_alias_``, ``_add_value_alias_``
1012-
1013-
To help keep Python 2 / Python 3 code in sync an :attr:`~Enum._order_` attribute can
1014-
be provided. It will be checked against the actual order of the enumeration
1015-
and raise an error if the two do not match::
1016-
1017-
>>> class Color(Enum):
1018-
... _order_ = 'RED GREEN BLUE'
1019-
... RED = 1
1020-
... BLUE = 3
1021-
... GREEN = 2
1022-
...
1023-
Traceback (most recent call last):
1024-
...
1025-
TypeError: member order does not match _order_:
1026-
['RED', 'BLUE', 'GREEN']
1027-
['RED', 'GREEN', 'BLUE']
1028-
1029-
.. note::
1030-
1031-
In Python 2 code the :attr:`~Enum._order_` attribute is necessary as definition
1032-
order is lost before it can be recorded.
973+
The supported ``__dunder__`` and ``_sunder_`` names can be found in the :ref:`Enum API documentation <enum-dunder-sunder>`.
1033974

1034975

1035976
_Private__names
1036-
"""""""""""""""
977+
^^^^^^^^^^^^^^^
1037978

1038979
:ref:`Private names <private-name-mangling>` are not converted to enum members,
1039980
but remain normal attributes.
@@ -1042,7 +983,7 @@ but remain normal attributes.
1042983

1043984

1044985
``Enum`` member type
1045-
""""""""""""""""""""
986+
^^^^^^^^^^^^^^^^^^^^
1046987

1047988
Enum members are instances of their enum class, and are normally accessed as
1048989
``EnumClass.member``. In certain situations, such as writing custom enum
@@ -1055,7 +996,7 @@ recommended.
1055996

1056997

1057998
Creating members that are mixed with other data types
1058-
"""""""""""""""""""""""""""""""""""""""""""""""""""""
999+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10591000

10601001
When subclassing other data types, such as :class:`int` or :class:`str`, with
10611002
an :class:`Enum`, all values after the ``=`` are passed to that data type's
@@ -1069,7 +1010,7 @@ constructor. For example::
10691010

10701011

10711012
Boolean value of ``Enum`` classes and members
1072-
"""""""""""""""""""""""""""""""""""""""""""""
1013+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10731014

10741015
Enum classes that are mixed with non-:class:`Enum` types (such as
10751016
:class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in
@@ -1084,7 +1025,7 @@ Plain :class:`Enum` classes always evaluate as :data:`True`.
10841025

10851026

10861027
``Enum`` classes with methods
1087-
"""""""""""""""""""""""""""""
1028+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10881029

10891030
If you give your enum subclass extra methods, like the `Planet`_
10901031
class below, those methods will show up in a :func:`dir` of the member,
@@ -1097,7 +1038,7 @@ but not of the class::
10971038

10981039

10991040
Combining members of ``Flag``
1100-
"""""""""""""""""""""""""""""
1041+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11011042

11021043
Iterating over a combination of :class:`Flag` members will only return the members that
11031044
are comprised of a single bit::
@@ -1117,7 +1058,7 @@ are comprised of a single bit::
11171058

11181059

11191060
``Flag`` and ``IntFlag`` minutia
1120-
""""""""""""""""""""""""""""""""
1061+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11211062

11221063
Using the following snippet for our examples::
11231064

@@ -1478,6 +1419,7 @@ alias::
14781419
behaviors as well as disallowing aliases. If the only desired change is
14791420
disallowing aliases, the :func:`unique` decorator can be used instead.
14801421

1422+
.. _multi-value-enum:
14811423

14821424
MultiValueEnum
14831425
^^^^^^^^^^^^^^^^^

Doc/library/enum.rst

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,28 @@ Data Types
307307
No longer used, kept for backward compatibility.
308308
(class attribute, removed during class creation).
309309

310+
The :attr:`~Enum._order_` attribute can be provided to help keep Python 2 / Python 3 code in sync.
311+
It will be checked against the actual order of the enumeration and raise an error if the two do not match::
312+
313+
>>> class Color(Enum):
314+
... _order_ = 'RED GREEN BLUE'
315+
... RED = 1
316+
... BLUE = 3
317+
... GREEN = 2
318+
...
319+
Traceback (most recent call last):
320+
...
321+
TypeError: member order does not match _order_:
322+
['RED', 'BLUE', 'GREEN']
323+
['RED', 'GREEN', 'BLUE']
324+
325+
.. note::
326+
327+
In Python 2 code the :attr:`~Enum._order_` attribute is necessary as definition
328+
order is lost before it can be recorded.
329+
330+
.. versionadded:: 3.6
331+
310332
.. attribute:: Enum._ignore_
311333

312334
``_ignore_`` is only used during creation and is removed from the
@@ -316,6 +338,8 @@ Data Types
316338
names will also be removed from the completed enumeration. See
317339
:ref:`TimePeriod <enum-time-period>` for an example.
318340

341+
.. versionadded:: 3.7
342+
319343
.. method:: Enum.__dir__(self)
320344

321345
Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and
@@ -346,7 +370,16 @@ Data Types
346370
:last_values: A list of the previous values.
347371

348372
A *staticmethod* that is used to determine the next value returned by
349-
:class:`auto`::
373+
:class:`auto`.
374+
375+
.. note::
376+
For standard :class:`Enum` classes the next value chosen is the highest
377+
value seen incremented by one.
378+
379+
For :class:`Flag` classes the next value chosen will be the next highest
380+
power-of-two.
381+
382+
This method may be overridden, e.g.::
350383

351384
>>> from enum import auto, Enum
352385
>>> class PowersOfThree(Enum):
@@ -359,6 +392,10 @@ Data Types
359392
>>> PowersOfThree.SECOND.value
360393
9
361394

395+
.. versionadded:: 3.6
396+
.. versionchanged:: 3.13
397+
Prior versions would use the last seen value instead of the highest value.
398+
362399
.. method:: Enum.__init__(self, *args, **kwds)
363400

364401
By default, does nothing. If multiple values are given in the member
@@ -397,6 +434,8 @@ Data Types
397434
>>> Build('deBUG')
398435
<Build.DEBUG: 'debug'>
399436

437+
.. versionadded:: 3.6
438+
400439
.. method:: Enum.__new__(cls, *args, **kwds)
401440

402441
By default, doesn't exist. If specified, either in the enum class
@@ -490,7 +529,8 @@ Data Types
490529
>>> Color(42)
491530
<Color.RED: 1>
492531

493-
Raises a :exc:`ValueError` if the value is already linked with a different member.
532+
| Raises a :exc:`ValueError` if the value is already linked with a different member.
533+
| See :ref:`multi-value-enum` for an example.
494534
495535
.. versionadded:: 3.13
496536

@@ -889,14 +929,16 @@ Data Types
889929

890930
---------------
891931

932+
.. _enum-dunder-sunder:
933+
892934
Supported ``__dunder__`` names
893935
""""""""""""""""""""""""""""""
894936

895937
:attr:`~EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member``
896938
items. It is only available on the class.
897939

898940
:meth:`~Enum.__new__`, if specified, must create and return the enum members;
899-
it is also a very good idea to set the member's :attr:`!_value_` appropriately.
941+
it is also a very good idea to set the member's :attr:`~Enum._value_` appropriately.
900942
Once all the members are created it is no longer used.
901943

902944

@@ -912,17 +954,10 @@ Supported ``_sunder_`` names
912954
from the final class
913955
- :attr:`~Enum._order_` -- no longer used, kept for backward
914956
compatibility (class attribute, removed during class creation)
957+
915958
- :meth:`~Enum._generate_next_value_` -- used to get an appropriate value for
916959
an enum member; may be overridden
917960

918-
.. note::
919-
920-
For standard :class:`Enum` classes the next value chosen is the highest
921-
value seen incremented by one.
922-
923-
For :class:`Flag` classes the next value chosen will be the next highest
924-
power-of-two.
925-
926961
- :meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing
927962
member.
928963
- :meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an

Doc/library/signal.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ the synchronization primitives from the :mod:`threading` module instead.
6868

6969
Besides, only the main thread of the main interpreter is allowed to set a new signal handler.
7070

71+
.. warning::
72+
73+
Synchronization primitives such as :class:`threading.Lock` should not be used
74+
within signal handlers. Doing so can lead to unexpected deadlocks.
75+
7176

7277
Module contents
7378
---------------

Lib/test/test_socket.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,24 @@ def test_addressinfo_enum(self):
22222222
source=_socket)
22232223
enum._test_simple_enum(CheckedAddressInfo, socket.AddressInfo)
22242224

2225+
@unittest.skipUnless(hasattr(socket.socket, "sendmsg"),"sendmsg not supported")
2226+
def test_sendmsg_reentrant_ancillary_mutation(self):
2227+
2228+
class Mut:
2229+
def __index__(self):
2230+
seq.clear()
2231+
return 0
2232+
2233+
seq = [
2234+
(socket.SOL_SOCKET, Mut(), b'x'),
2235+
(socket.SOL_SOCKET, 0, b'x'),
2236+
]
2237+
2238+
left, right = socket.socketpair()
2239+
self.addCleanup(left.close)
2240+
self.addCleanup(right.close)
2241+
self.assertRaises(OSError, left.sendmsg, [b'x'], seq)
2242+
22252243

22262244
@unittest.skipUnless(HAVE_SOCKET_CAN, 'SocketCan required for this test.')
22272245
class BasicCANTest(unittest.TestCase):

Lib/test/test_ssl.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,12 @@ def test_min_max_version(self):
11561156
ctx.maximum_version = ssl.TLSVersion.MINIMUM_SUPPORTED
11571157
self.assertIn(
11581158
ctx.maximum_version,
1159-
{ssl.TLSVersion.TLSv1, ssl.TLSVersion.TLSv1_1, ssl.TLSVersion.SSLv3}
1159+
{
1160+
ssl.TLSVersion.TLSv1,
1161+
ssl.TLSVersion.TLSv1_1,
1162+
ssl.TLSVersion.TLSv1_2,
1163+
ssl.TLSVersion.SSLv3,
1164+
}
11601165
)
11611166

11621167
ctx.minimum_version = ssl.TLSVersion.MAXIMUM_SUPPORTED
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a crash in socket.sendmsg() that could occur if ancillary data is mutated re-entrantly during argument parsing.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updated bundled version of OpenSSL to 3.5.5.

Misc/externals.spdx.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@
7070
"checksums": [
7171
{
7272
"algorithm": "SHA256",
73-
"checksumValue": "9b07560b6c1afa666bd78b8d3aa5c83fdda02149afdf048596d5b0e0dac1ee55"
73+
"checksumValue": "619b30acf7d9b13c9d0ba90d17349e8b524c380cd23d39334b143f74dc4e5ec9"
7474
}
7575
],
76-
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/openssl-3.0.18.tar.gz",
76+
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/openssl-3.5.5.tar.gz",
7777
"externalRefs": [
7878
{
7979
"referenceCategory": "SECURITY",
80-
"referenceLocator": "cpe:2.3:a:openssl:openssl:3.0.18:*:*:*:*:*:*:*",
80+
"referenceLocator": "cpe:2.3:a:openssl:openssl:3.5.5:*:*:*:*:*:*:*",
8181
"referenceType": "cpe23Type"
8282
}
8383
],
8484
"licenseConcluded": "NOASSERTION",
8585
"name": "openssl",
8686
"primaryPackagePurpose": "SOURCE",
87-
"versionInfo": "3.0.18"
87+
"versionInfo": "3.5.5"
8888
},
8989
{
9090
"SPDXID": "SPDXRef-PACKAGE-sqlite",

Modules/_ssl_data_36.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* File generated by Tools/ssl/make_ssl_data.py */
2-
/* Generated on 2026-01-17T13:03:49.335767+00:00 */
3-
/* Generated from Git commit openssl-3.6.0-0-g7b371d80d9 */
2+
/* Generated on 2026-02-13T18:19:19.227109+00:00 */
3+
/* Generated from Git commit openssl-3.6.1-0-gc9a9e5b10 */
44

55
/* generated from args.lib2errnum */
66
static struct py_ssl_library_code library_codes[] = {
@@ -1668,6 +1668,11 @@ static struct py_ssl_error_code error_codes[] = {
16681668
#else
16691669
{"CERTIFICATE_VERIFY_ERROR", 46, 100},
16701670
#endif
1671+
#ifdef CMS_R_CIPHER_AEAD_IN_ENVELOPED_DATA
1672+
{"CIPHER_AEAD_IN_ENVELOPED_DATA", ERR_LIB_CMS, CMS_R_CIPHER_AEAD_IN_ENVELOPED_DATA},
1673+
#else
1674+
{"CIPHER_AEAD_IN_ENVELOPED_DATA", 46, 200},
1675+
#endif
16711676
#ifdef CMS_R_CIPHER_AEAD_SET_TAG_ERROR
16721677
{"CIPHER_AEAD_SET_TAG_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_AEAD_SET_TAG_ERROR},
16731678
#else

0 commit comments

Comments
 (0)