Skip to content

Commit 182daf8

Browse files
committed
updated to python 3.9.8
1 parent 1a964a5 commit 182daf8

157 files changed

Lines changed: 1126 additions & 1165 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.

PythonLib/full/_osx_support.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ def _default_sysroot(cc):
156156

157157
if _cache_default_sysroot is not None:
158158
return _cache_default_sysroot
159-
159+
160160
contents = _read_output('%s -c -E -v - </dev/null' % (cc,), True)
161-
in_incdirs = False
161+
in_incdirs = False
162162
for line in contents.splitlines():
163163
if line.startswith("#include <...>"):
164164
in_incdirs = True
@@ -482,7 +482,7 @@ def customize_compiler(_config_vars):
482482
483483
This customization is performed when the first
484484
extension module build is requested
485-
in distutils.sysconfig.customize_compiler).
485+
in distutils.sysconfig.customize_compiler.
486486
"""
487487

488488
# Find a compiler to use for extension module builds

PythonLib/full/argparse.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,13 @@ def _format_action(self, action):
526526
parts = [action_header]
527527

528528
# if there was help for the action, add lines of help text
529-
if action.help:
529+
if action.help and action.help.strip():
530530
help_text = self._expand_help(action)
531-
help_lines = self._split_lines(help_text, help_width)
532-
parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
533-
for line in help_lines[1:]:
534-
parts.append('%*s%s\n' % (help_position, '', line))
531+
if help_text:
532+
help_lines = self._split_lines(help_text, help_width)
533+
parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
534+
for line in help_lines[1:]:
535+
parts.append('%*s%s\n' % (help_position, '', line))
535536

536537
# or add a newline if the description doesn't end with one
537538
elif not action_header.endswith('\n'):
@@ -1208,7 +1209,8 @@ def __call__(self, parser, namespace, values, option_string=None):
12081209
# namespace for the relevant parts.
12091210
subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
12101211
for key, value in vars(subnamespace).items():
1211-
setattr(namespace, key, value)
1212+
if not hasattr(namespace, key):
1213+
setattr(namespace, key, value)
12121214

12131215
if arg_strings:
12141216
vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
@@ -1842,11 +1844,6 @@ def parse_known_args(self, args=None, namespace=None):
18421844
if action.default is not SUPPRESS:
18431845
setattr(namespace, action.dest, action.default)
18441846

1845-
# add any parser defaults that aren't present
1846-
for dest in self._defaults:
1847-
if not hasattr(namespace, dest):
1848-
setattr(namespace, dest, self._defaults[dest])
1849-
18501847
# parse the arguments and exit if there are any errors
18511848
if self.exit_on_error:
18521849
try:
@@ -1857,6 +1854,11 @@ def parse_known_args(self, args=None, namespace=None):
18571854
else:
18581855
namespace, args = self._parse_known_args(args, namespace)
18591856

1857+
# add any parser defaults that aren't present
1858+
for dest in self._defaults:
1859+
if not hasattr(namespace, dest):
1860+
setattr(namespace, dest, self._defaults[dest])
1861+
18601862
if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):
18611863
args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))
18621864
delattr(namespace, _UNRECOGNIZED_ARGS_ATTR)

PythonLib/full/asyncio/base_events.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ async def start_serving(self):
350350
self._start_serving()
351351
# Skip one loop iteration so that all 'loop.add_reader'
352352
# go through.
353-
await tasks.sleep(0, loop=self._loop)
353+
await tasks.sleep(0)
354354

355355
async def serve_forever(self):
356356
if self._serving_forever_fut is not None:
@@ -539,7 +539,7 @@ async def shutdown_asyncgens(self):
539539
closing_agens = list(self._asyncgens)
540540
self._asyncgens.clear()
541541

542-
results = await tasks.gather(
542+
results = await tasks._gather(
543543
*[ag.aclose() for ag in closing_agens],
544544
return_exceptions=True,
545545
loop=self)
@@ -1457,7 +1457,7 @@ async def create_server(
14571457
fs = [self._create_server_getaddrinfo(host, port, family=family,
14581458
flags=flags)
14591459
for host in hosts]
1460-
infos = await tasks.gather(*fs, loop=self)
1460+
infos = await tasks._gather(*fs, loop=self)
14611461
infos = set(itertools.chain.from_iterable(infos))
14621462

14631463
completed = False
@@ -1515,7 +1515,7 @@ async def create_server(
15151515
server._start_serving()
15161516
# Skip one loop iteration so that all 'loop.add_reader'
15171517
# go through.
1518-
await tasks.sleep(0, loop=self)
1518+
await tasks.sleep(0)
15191519

15201520
if self._debug:
15211521
logger.info("%r is serving", server)

PythonLib/full/asyncio/events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ async def connect_read_pipe(self, protocol_factory, pipe):
465465
# The reason to accept file-like object instead of just file descriptor
466466
# is: we need to own pipe and close it at transport finishing
467467
# Can got complicated errors if pass f.fileno(),
468-
# close fd in pipe transport then close f and vise versa.
468+
# close fd in pipe transport then close f and vice versa.
469469
raise NotImplementedError
470470

471471
async def connect_write_pipe(self, protocol_factory, pipe):
@@ -478,7 +478,7 @@ async def connect_write_pipe(self, protocol_factory, pipe):
478478
# The reason to accept file-like object instead of just file descriptor
479479
# is: we need to own pipe and close it at transport finishing
480480
# Can got complicated errors if pass f.fileno(),
481-
# close fd in pipe transport then close f and vise versa.
481+
# close fd in pipe transport then close f and vice versa.
482482
raise NotImplementedError
483483

484484
async def subprocess_shell(self, protocol_factory, cmd, *,

PythonLib/full/asyncio/runners.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _cancel_all_tasks(loop):
6161
task.cancel()
6262

6363
loop.run_until_complete(
64-
tasks.gather(*to_cancel, loop=loop, return_exceptions=True))
64+
tasks._gather(*to_cancel, loop=loop, return_exceptions=True))
6565

6666
for task in to_cancel:
6767
if task.cancelled():

PythonLib/full/asyncio/subprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ async def communicate(self, input=None):
193193
stderr = self._read_stream(2)
194194
else:
195195
stderr = self._noop()
196-
stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr,
197-
loop=self._loop)
196+
stdin, stdout, stderr = await tasks._gather(stdin, stdout, stderr,
197+
loop=self._loop)
198198
await self.wait()
199199
return (stdout, stderr)
200200

PythonLib/full/asyncio/tasks.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,16 @@ def as_completed(fs, *, loop=None, timeout=None):
580580
if futures.isfuture(fs) or coroutines.iscoroutine(fs):
581581
raise TypeError(f"expect an iterable of futures, not {type(fs).__name__}")
582582

583+
if loop is not None:
584+
warnings.warn("The loop argument is deprecated since Python 3.8, "
585+
"and scheduled for removal in Python 3.10.",
586+
DeprecationWarning, stacklevel=2)
587+
583588
from .queues import Queue # Import here to avoid circular import problem.
584589
done = Queue(loop=loop)
585590

586591
if loop is None:
587592
loop = events.get_event_loop()
588-
else:
589-
warnings.warn("The loop argument is deprecated since Python 3.8, "
590-
"and scheduled for removal in Python 3.10.",
591-
DeprecationWarning, stacklevel=2)
592593
todo = {ensure_future(f, loop=loop) for f in set(fs)}
593594
timeout_handle = None
594595

@@ -756,6 +757,10 @@ def gather(*coros_or_futures, loop=None, return_exceptions=False):
756757
"and scheduled for removal in Python 3.10.",
757758
DeprecationWarning, stacklevel=2)
758759

760+
return _gather(*coros_or_futures, loop=loop, return_exceptions=return_exceptions)
761+
762+
763+
def _gather(*coros_or_futures, loop=None, return_exceptions=False):
759764
if not coros_or_futures:
760765
if loop is None:
761766
loop = events.get_event_loop()

PythonLib/full/asyncio/unix_events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ async def create_unix_server(
323323
server._start_serving()
324324
# Skip one loop iteration so that all 'loop.add_reader'
325325
# go through.
326-
await tasks.sleep(0, loop=self)
326+
await tasks.sleep(0)
327327

328328
return server
329329

@@ -1383,7 +1383,7 @@ def add_child_handler(self, pid, callback, *args):
13831383
def remove_child_handler(self, pid):
13841384
# asyncio never calls remove_child_handler() !!!
13851385
# The method is no-op but is implemented because
1386-
# abstract base classe requires it
1386+
# abstract base classes require it.
13871387
return True
13881388

13891389
def attach_loop(self, loop):

PythonLib/full/compileall.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ def main():
365365
'environment variable is set, and '
366366
'"timestamp" otherwise.'))
367367
parser.add_argument('-o', action='append', type=int, dest='opt_levels',
368-
help=('Optimization levels to run compilation with.'
369-
'Default is -1 which uses optimization level of'
370-
'Python interpreter itself (specified by -O).'))
368+
help=('Optimization levels to run compilation with. '
369+
'Default is -1 which uses the optimization level '
370+
'of the Python interpreter itself (see -O).'))
371371
parser.add_argument('-e', metavar='DIR', dest='limit_sl_dest',
372372
help='Ignore symlinks pointing outsite of the DIR')
373373
parser.add_argument('--hardlink-dupes', action='store_true',

PythonLib/full/concurrent/futures/thread.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ def _python_exit():
3636
# See bpo-39812 for context.
3737
threading._register_atexit(_python_exit)
3838

39+
# At fork, reinitialize the `_global_shutdown_lock` lock in the child process
40+
if hasattr(os, 'register_at_fork'):
41+
os.register_at_fork(before=_global_shutdown_lock.acquire,
42+
after_in_child=_global_shutdown_lock._at_fork_reinit,
43+
after_in_parent=_global_shutdown_lock.release)
44+
3945

4046
class _WorkItem(object):
4147
def __init__(self, future, fn, args, kwargs):

0 commit comments

Comments
 (0)