Skip to content

Commit 8b76051

Browse files
committed
Merge branch 'main' into inlinecomp2
* main: pythongh-98831: rewrite PUSH_EXC_INFO and conditional jumps in the instruction definition DSL (python#101481) pythongh-98831: Modernize the LOAD_ATTR family (python#101488) pythongh-101498 : Fix asyncio.Timeout example in docs (python#101499) pythongh-101454: fix documentation for END_ASYNC_FOR (python#101455) pythongh-101277: Isolate itertools, add group and _grouper types to module state (python#101302) pythongh-101317: Add `ssl_shutdown_timeout` parameter for `asyncio.StreamWriter.start_tls` (python#101335) datetime.rst: fix combine() signature (python#101490)
2 parents db208d5 + b91b42d commit 8b76051

File tree

14 files changed

+496
-449
lines changed

14 files changed

+496
-449
lines changed

Doc/library/asyncio-stream.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ StreamWriter
335335
returns immediately.
336336

337337
.. coroutinemethod:: start_tls(sslcontext, \*, server_hostname=None, \
338-
ssl_handshake_timeout=None)
338+
ssl_handshake_timeout=None, ssl_shutdown_timeout=None)
339339

340340
Upgrade an existing stream-based connection to TLS.
341341

@@ -350,8 +350,16 @@ StreamWriter
350350
handshake to complete before aborting the connection. ``60.0`` seconds
351351
if ``None`` (default).
352352

353+
* *ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown
354+
to complete before aborting the connection. ``30.0`` seconds if ``None``
355+
(default).
356+
353357
.. versionadded:: 3.11
354358

359+
.. versionchanged:: 3.12
360+
Added the *ssl_shutdown_timeout* parameter.
361+
362+
355363
.. method:: is_closing()
356364

357365
Return ``True`` if the stream is closed or in the process of

Doc/library/asyncio-task.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ Timeouts
666666
except TimeoutError:
667667
pass
668668

669-
if cm.expired:
669+
if cm.expired():
670670
print("Looks like we haven't finished on time.")
671671

672672
Timeout context managers can be safely nested.

Doc/library/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ Other constructors, all class methods:
975975
microsecond of the result are all 0, and :attr:`.tzinfo` is ``None``.
976976

977977

978-
.. classmethod:: datetime.combine(date, time, tzinfo=self.tzinfo)
978+
.. classmethod:: datetime.combine(date, time, tzinfo=time.tzinfo)
979979

980980
Return a new :class:`.datetime` object whose date components are equal to the
981981
given :class:`date` object's, and whose time components

Doc/library/dis.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,9 @@ not have to be) the original ``STACK[-2]``.
616616
.. opcode:: END_ASYNC_FOR
617617

618618
Terminates an :keyword:`async for` loop. Handles an exception raised
619-
when awaiting a next item. If ``STACK[-1]`` is :exc:`StopAsyncIteration` pop 3
620-
values from the stack and restore the exception state using the second
621-
of them. Otherwise re-raise the exception using the value
622-
from the stack. An exception handler block is removed from the block stack.
619+
when awaiting a next item. The stack contains the async iterable in
620+
``STACK[-2]`` and the raised exception in ``STACK[-1]``. Both are popped.
621+
If the exception is not :exc:`StopAsyncIteration`, it is re-raised.
623622

624623
.. versionadded:: 3.8
625624

Lib/asyncio/streams.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,15 +378,17 @@ async def drain(self):
378378

379379
async def start_tls(self, sslcontext, *,
380380
server_hostname=None,
381-
ssl_handshake_timeout=None):
381+
ssl_handshake_timeout=None,
382+
ssl_shutdown_timeout=None):
382383
"""Upgrade an existing stream-based connection to TLS."""
383384
server_side = self._protocol._client_connected_cb is not None
384385
protocol = self._protocol
385386
await self.drain()
386387
new_transport = await self._loop.start_tls( # type: ignore
387388
self._transport, protocol, sslcontext,
388389
server_side=server_side, server_hostname=server_hostname,
389-
ssl_handshake_timeout=ssl_handshake_timeout)
390+
ssl_handshake_timeout=ssl_handshake_timeout,
391+
ssl_shutdown_timeout=ssl_shutdown_timeout)
390392
self._transport = new_transport
391393
protocol._replace_writer(self)
392394

Lib/test/test_itertools.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,38 @@ def test_zip_longest_result_gc(self):
16941694
gc.collect()
16951695
self.assertTrue(gc.is_tracked(next(it)))
16961696

1697+
@support.cpython_only
1698+
def test_immutable_types(self):
1699+
from itertools import _grouper, _tee, _tee_dataobject
1700+
dataset = (
1701+
accumulate,
1702+
batched,
1703+
chain,
1704+
combinations,
1705+
combinations_with_replacement,
1706+
compress,
1707+
count,
1708+
cycle,
1709+
dropwhile,
1710+
filterfalse,
1711+
groupby,
1712+
_grouper,
1713+
islice,
1714+
pairwise,
1715+
permutations,
1716+
product,
1717+
repeat,
1718+
starmap,
1719+
takewhile,
1720+
_tee,
1721+
_tee_dataobject,
1722+
zip_longest,
1723+
)
1724+
for tp in dataset:
1725+
with self.subTest(tp=tp):
1726+
with self.assertRaisesRegex(TypeError, "immutable"):
1727+
tp.foobar = 1
1728+
16971729

16981730
class TestExamples(unittest.TestCase):
16991731

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add *ssl_shutdown_timeout* parameter for :meth:`asyncio.StreamWriter.start_tls`.
2+

Modules/clinic/itertoolsmodule.c.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)