Skip to content

Commit 3fac250

Browse files
authored
Merge pull request #518 from python/main
Sync Fork from Upstream Repo
2 parents d61d997 + f572cbf commit 3fac250

27 files changed

Lines changed: 217 additions & 40 deletions

Doc/library/bz2.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,8 @@ Writing and reading a bzip2-compressed file in binary mode:
325325
... content = f.read()
326326
>>> content == data # Check equality to original object after round-trip
327327
True
328+
329+
.. testcleanup::
330+
331+
import os
332+
os.remove("myfile.bz2")

Doc/library/configparser.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ can be customized by end users easily.
4646

4747
import configparser
4848

49+
.. testcleanup::
50+
51+
import os
52+
os.remove("example.ini")
53+
4954

5055
Quick Start
5156
-----------

Doc/library/io.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ I/O Base Classes
391391
to control the number of lines read: no more lines will be read if the
392392
total size (in bytes/characters) of all lines so far exceeds *hint*.
393393

394+
*hint* values of ``0`` or less, as well as ``None``, are treated as no
395+
hint.
396+
394397
Note that it's already possible to iterate on file objects using ``for
395398
line in file: ...`` without calling ``file.readlines()``.
396399

Doc/reference/expressions.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ A comprehension in an :keyword:`!async def` function may consist of either a
218218
:keyword:`!for` or :keyword:`!async for` clause following the leading
219219
expression, may contain additional :keyword:`!for` or :keyword:`!async for`
220220
clauses, and may also use :keyword:`await` expressions.
221-
If a comprehension contains either :keyword:`!async for` clauses
222-
or :keyword:`!await` expressions it is called an
223-
:dfn:`asynchronous comprehension`. An asynchronous comprehension may
221+
If a comprehension contains either :keyword:`!async for` clauses or
222+
:keyword:`!await` expressions or other asynchronous comprehensions it is called
223+
an :dfn:`asynchronous comprehension`. An asynchronous comprehension may
224224
suspend the execution of the coroutine function in which it appears.
225225
See also :pep:`530`.
226226

@@ -230,6 +230,11 @@ See also :pep:`530`.
230230
.. versionchanged:: 3.8
231231
``yield`` and ``yield from`` prohibited in the implicitly nested scope.
232232

233+
.. versionchanged:: 3.11
234+
Asynchronous comprehensions are now allowed inside comprehensions in
235+
asynchronous functions. Outer comprehensions implicitly become
236+
asynchronous.
237+
233238

234239
.. _lists:
235240

Doc/whatsnew/3.11.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,19 @@ See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan Taskaya
148148
and Ammar Askar in :issue:`43950`.)
149149

150150

151-
152151
Other Language Changes
153152
======================
154153

155-
A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in
156-
:meth:`contextlib.ExitStack.enter_context` and
157-
:meth:`contextlib.AsyncExitStack.enter_async_context` for objects which do not
158-
support the :term:`context manager` or :term:`asynchronous context manager`
159-
protocols correspondingly.
160-
(Contributed by Serhiy Storchaka in :issue:`44471`.)
154+
* Asynchronous comprehensions are now allowed inside comprehensions in
155+
asynchronous functions. Outer comprehensions implicitly become
156+
asynchronous. (Contributed by Serhiy Storchaka in :issue:`33346`.)
157+
158+
* A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in
159+
:meth:`contextlib.ExitStack.enter_context` and
160+
:meth:`contextlib.AsyncExitStack.enter_async_context` for objects which do not
161+
support the :term:`context manager` or :term:`asynchronous context manager`
162+
protocols correspondingly.
163+
(Contributed by Serhiy Storchaka in :issue:`44471`.)
161164

162165
* A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in
163166
:keyword:`with` and :keyword:`async with` statements for objects which do not

Lib/configparser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ class RawConfigParser(MutableMapping):
563563
# Regular expressions for parsing section headers and options
564564
_SECT_TMPL = r"""
565565
\[ # [
566-
(?P<header>[^]]+) # very permissive!
566+
(?P<header>.+) # very permissive!
567567
\] # ]
568568
"""
569569
_OPT_TMPL = r"""

Lib/inspect.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,10 +2096,6 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True):
20962096
"""Private helper to parse content of '__text_signature__'
20972097
and return a Signature based on it.
20982098
"""
2099-
# Lazy import ast because it's relatively heavy and
2100-
# it's not used for other than this function.
2101-
import ast
2102-
21032099
Parameter = cls._parameter_cls
21042100

21052101
clean_signature, self_parameter, last_positional_only = \

Lib/lib2to3/btm_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ def reduce_tree(node, parent=None):
220220
else:
221221
#TODO: handle {min, max} repeaters
222222
raise NotImplementedError
223-
pass
224223

225224
#add children
226225
if details_node and new_node is not None:

Lib/multiprocessing/managers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,6 @@ def __init__(self, *args, **kwargs):
13371337

13381338
def __del__(self):
13391339
util.debug(f"{self.__class__.__name__}.__del__ by pid {getpid()}")
1340-
pass
13411340

13421341
def get_server(self):
13431342
'Better than monkeypatching for now; merge into Server ultimately'

Lib/platform.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def _syscmd_ver(system='', release='', version='',
280280
for cmd in ('ver', 'command /c ver', 'cmd /c ver'):
281281
try:
282282
info = subprocess.check_output(cmd,
283+
stdin=subprocess.DEVNULL,
283284
stderr=subprocess.DEVNULL,
284285
text=True,
285286
shell=True)

0 commit comments

Comments
 (0)