Skip to content

Commit 95c25fb

Browse files
authored
Merge branch '3.14' into backport-9036982-3.14
2 parents 8856be0 + f9fdb30 commit 95c25fb

19 files changed

Lines changed: 165 additions & 69 deletions

Android/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def unpack_deps(host, prefix_dir, cache_dir):
221221
for name_ver in [
222222
"bzip2-1.0.8-3",
223223
"libffi-3.4.4-3",
224-
"openssl-3.5.7-0",
224+
"openssl-3.5.8-0",
225225
"sqlite-3.50.4-0",
226226
"xz-5.4.6-1",
227227
"zstd-1.5.7-2"

Apple/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def unpack_deps(
328328
for name_ver in [
329329
"BZip2-1.0.8-2",
330330
"libFFI-3.4.7-2",
331-
"OpenSSL-3.5.7-1",
331+
"OpenSSL-3.5.8-1",
332332
"XZ-5.6.4-2",
333333
"mpdecimal-4.0.0-2",
334334
"zstd-1.5.7-1",

Doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
# Skip if downstream redistributors haven't installed them
4242
_OPTIONAL_EXTENSIONS = (
43-
'linklint.ext',
43+
'sphinx_linklint.ext',
4444
'notfound.extension',
4545
'sphinxext.opengraph',
4646
'sphinxcontrib.rsvgconverter',

Doc/library/os.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4139,16 +4139,17 @@ Naturally, they are all only available on Linux.
41394139
- :const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)
41404140

41414141
If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide
4142-
real-time clock is used. If system clock is changed, timer setting need
4143-
to be updated. To cancel timer when system clock is changed, see
4142+
real-time clock is used. If the system clock is changed, the timer setting
4143+
needs to be updated. To cancel the timer when the system clock is changed, see
41444144
:const:`TFD_TIMER_CANCEL_ON_SET`.
41454145

41464146
If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically
41474147
increasing clock is used. Even if the system clock is changed, the timer
41484148
setting will not be affected.
41494149

4150-
If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time.CLOCK_MONOTONIC`
4151-
except it includes any time that the system is suspended.
4150+
If *clockid* is :const:`time.CLOCK_BOOTTIME`, it is the same as
4151+
:const:`time.CLOCK_MONOTONIC` except it includes any time that the system
4152+
is suspended.
41524153

41534154
The file descriptor's behaviour can be modified by specifying a *flags* value.
41544155
Any of the following variables may be used, combined using bitwise OR
@@ -4159,8 +4160,8 @@ Naturally, they are all only available on Linux.
41594160

41604161
If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until
41614162
the timer expires. If it is set as a flag, :func:`read` doesn't block, but
4162-
If there hasn't been an expiration since the last call to read,
4163-
:func:`read` raises :class:`OSError` with ``errno`` is set to
4163+
if there hasn't been an expiration since the last call to read,
4164+
:func:`read` raises :class:`OSError` with ``errno`` set to
41644165
:const:`errno.EAGAIN`.
41654166

41664167
:const:`TFD_CLOEXEC` is always set by Python automatically.
@@ -4175,7 +4176,7 @@ Naturally, they are all only available on Linux.
41754176
.. versionadded:: 3.13
41764177

41774178

4178-
.. function:: timerfd_settime(fd, /, *, flags=flags, initial=0.0, interval=0.0)
4179+
.. function:: timerfd_settime(fd, /, *, flags=0, initial=0.0, interval=0.0)
41794180

41804181
Alter a timer file descriptor's internal timer.
41814182
This function operates the same interval timer as :func:`timerfd_settime_ns`.
@@ -4190,12 +4191,11 @@ Naturally, they are all only available on Linux.
41904191
- :const:`TFD_TIMER_CANCEL_ON_SET`
41914192

41924193
The timer is disabled by setting *initial* to zero (``0``).
4193-
If *initial* is equal to or greater than zero, the timer is enabled.
4194+
If *initial* is greater than zero, the timer is enabled.
41944195
If *initial* is less than zero, it raises an :class:`OSError` exception
4195-
with ``errno`` set to :const:`errno.EINVAL`
4196+
with ``errno`` set to :const:`errno.EINVAL`.
41964197

41974198
By default the timer will fire when *initial* seconds have elapsed.
4198-
(If *initial* is zero, timer will fire immediately.)
41994199

42004200
However, if the :const:`TFD_TIMER_ABSTIME` flag is set,
42014201
the timer will fire when the timer's clock
@@ -4206,13 +4206,13 @@ Naturally, they are all only available on Linux.
42064206
If *interval* is greater than zero, the timer fires every time *interval*
42074207
seconds have elapsed since the previous expiration.
42084208
If *interval* is less than zero, it raises :class:`OSError` with ``errno``
4209-
set to :const:`errno.EINVAL`
4209+
set to :const:`errno.EINVAL`.
42104210

42114211
If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with
42124212
:const:`TFD_TIMER_ABSTIME` and the clock for this timer is
42134213
:const:`time.CLOCK_REALTIME`, the timer is marked as cancelable if the
42144214
real-time clock is changed discontinuously. Reading the descriptor is
4215-
aborted with the error ECANCELED.
4215+
aborted with the error :const:`errno.ECANCELED`.
42164216

42174217
Linux manages system clock as UTC. A daylight-savings time transition is
42184218
done by changing time offset only and doesn't cause discontinuous system

Doc/library/turtle.rst

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
**Source code:** :source:`Lib/turtle.py`
1111

1212
.. testsetup:: default
13+
:skipif: _tkinter is None
1314

1415
from turtle import *
1516
turtle = Turtle()
1617

1718
.. testcleanup::
19+
:skipif: _tkinter is None
1820

1921
import os
2022
os.remove("my_drawing.ps")
@@ -509,6 +511,7 @@ Turtle motion
509511
turtle is headed. Do not change the turtle's heading.
510512

511513
.. doctest::
514+
:skipif: _tkinter is None
512515
:hide:
513516

514517
>>> turtle.goto(0, 0)
@@ -851,6 +854,7 @@ Turtle motion
851854
last *n* stamps.
852855

853856
.. doctest::
857+
:skipif: _tkinter is None
854858

855859
>>> for i in range(8):
856860
... unused_stamp_id = turtle.stamp()
@@ -1408,8 +1412,11 @@ More drawing control
14081412
font. If *move* is true, the pen is moved to the bottom-right corner of the
14091413
text. By default, *move* is ``False``.
14101414

1411-
>>> turtle.write("Home = ", True, align="center")
1412-
>>> turtle.write((0,0), True)
1415+
.. doctest::
1416+
:skipif: _tkinter is None
1417+
1418+
>>> turtle.write("Home = ", True, align="center")
1419+
>>> turtle.write((0,0), True)
14131420

14141421

14151422
Turtle state
@@ -1446,12 +1453,15 @@ Visibility
14461453

14471454
Return ``True`` if the Turtle is shown, ``False`` if it's hidden.
14481455

1449-
>>> turtle.hideturtle()
1450-
>>> turtle.isvisible()
1451-
False
1452-
>>> turtle.showturtle()
1453-
>>> turtle.isvisible()
1454-
True
1456+
.. doctest::
1457+
:skipif: _tkinter is None
1458+
1459+
>>> turtle.hideturtle()
1460+
>>> turtle.isvisible()
1461+
False
1462+
>>> turtle.showturtle()
1463+
>>> turtle.isvisible()
1464+
True
14551465

14561466

14571467
Appearance
@@ -1982,6 +1992,9 @@ Window control
19821992
method, one can make visible those parts of a drawing which were outside the
19831993
canvas before.
19841994

1995+
.. doctest::
1996+
:skipif: _tkinter is None
1997+
19851998
>>> screen.screensize()
19861999
(400, 300)
19872000
>>> screen.screensize(2000,1500)

Doc/requirements.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ sphinx<9.0.0
1111

1212
blurb
1313

14-
sphinxext-opengraph~=0.13.0
14+
sphinx-linklint
1515
sphinx-notfound-page~=1.0.0
16+
sphinxext-opengraph~=0.13.0
1617

1718
# The theme used by the documentation is stored separately, so we need
1819
# to install that as well.
1920
python-docs-theme>=2023.3.1,!=2023.7
2021

21-
linklint
22-
2322
-c constraints.txt

Doc/tutorial/modules.rst

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -584,20 +584,6 @@ Since the main module does not have a package, modules intended for use
584584
as the main module of a Python application must always use absolute imports.
585585

586586

587-
Packages in Multiple Directories
588-
--------------------------------
589-
590-
Packages support one more special attribute, :attr:`~module.__path__`. This is
591-
initialized to be a :term:`sequence` of strings containing the name of the
592-
directory holding the
593-
package's :file:`__init__.py` before the code in that file is executed. This
594-
variable can be modified; doing so affects future searches for modules and
595-
subpackages contained in the package.
596-
597-
While this feature is not often needed, it can be used to extend the set of
598-
modules found in a package.
599-
600-
601587
.. rubric:: Footnotes
602588

603589
.. [#] In fact function definitions are also 'statements' that are 'executed'; the

Lib/queue.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ def get(self, block=True, timeout=None):
346346
available, else raise the Empty exception ('timeout' is ignored
347347
in that case).
348348
'''
349-
if timeout is not None and timeout < 0:
349+
if not block:
350+
timeout = None
351+
elif timeout is not None and timeout < 0:
350352
raise ValueError("'timeout' must be a non-negative number")
351353
if not self._count.acquire(block, timeout):
352354
raise Empty

Lib/test/test_hmac.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,19 +1452,25 @@ class OperatorCompareDigestTestCase(CompareDigestMixin, unittest.TestCase):
14521452
class PyMiscellaneousTests(unittest.TestCase):
14531453
"""Miscellaneous tests for the pure Python HMAC module."""
14541454

1455+
@staticmethod
1456+
def mock__compute_digest_fallback(hmac):
1457+
fn = getattr(hmac, meth := "_compute_digest_fallback")
1458+
return patch.object(hmac, meth, wraps=fn)
1459+
1460+
@staticmethod
1461+
def mock_HMAC_method(hmac, method):
1462+
fn = getattr(hmac.HMAC, method)
1463+
return patch.object(hmac.HMAC, method, autospec=True, wraps=fn)
1464+
14551465
@hashlib_helper.requires_builtin_hmac()
14561466
def test_hmac_constructor_uses_builtin(self):
14571467
# Block the OpenSSL implementation and check that
14581468
# HMAC() uses the built-in implementation instead.
14591469
hmac = import_fresh_module("hmac", blocked=["_hashlib"])
14601470

1461-
def watch_method(cls, name):
1462-
wraps = getattr(cls, name)
1463-
return patch.object(cls, name, autospec=True, wraps=wraps)
1464-
14651471
with (
1466-
watch_method(hmac.HMAC, '_init_openssl_hmac') as f,
1467-
watch_method(hmac.HMAC, '_init_builtin_hmac') as g,
1472+
self.mock_HMAC_method(hmac, '_init_openssl_hmac') as f,
1473+
self.mock_HMAC_method(hmac, '_init_builtin_hmac') as g,
14681474
):
14691475
_ = hmac.HMAC(b'key', b'msg', digestmod="sha256")
14701476
f.assert_not_called()
@@ -1535,11 +1541,11 @@ def do_test_hmac_digest_overflow_error_switch_to_slow(self, hmac, size):
15351541
bigkey = b'K' * size
15361542
bigmsg = b'M' * size
15371543

1538-
with patch.object(hmac, "_compute_digest_fallback") as slow:
1544+
with self.mock__compute_digest_fallback(hmac) as slow:
15391545
hmac.digest(bigkey, b'm', "md5")
15401546
slow.assert_called_once()
15411547

1542-
with patch.object(hmac, "_compute_digest_fallback") as slow:
1548+
with self.mock__compute_digest_fallback(hmac) as slow:
15431549
hmac.digest(b'k', bigmsg, "md5")
15441550
slow.assert_called_once()
15451551

@@ -1550,7 +1556,7 @@ def test_hmac_digest_no_overflow_error_in_fallback(self, size):
15501556

15511557
for key, msg in [(b'K' * size, b'm'), (b'k', b'M' * size)]:
15521558
with self.subTest(keysize=len(key), msgsize=len(msg)):
1553-
with patch.object(hmac, "_compute_digest_fallback") as slow:
1559+
with self.mock__compute_digest_fallback(hmac) as slow:
15541560
hmac.digest(key, msg, "md5")
15551561
slow.assert_called_once()
15561562

Lib/test/test_queue.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,11 @@ def test_negative_timeout_raises_exception(self):
954954
with self.assertRaises(ValueError):
955955
q.get(timeout=-1)
956956

957+
def test_nonblocking_ignores_timeout(self):
958+
q = self.q
959+
with self.assertRaises(self.queue.Empty):
960+
q.get(block=False, timeout=-1)
961+
957962
def test_order(self):
958963
# Test a pair of concurrent put() and get()
959964
q = self.q

0 commit comments

Comments
 (0)