Skip to content

Commit 24cd92f

Browse files
committed
updated to python 3.8.9
1 parent 36c7cd0 commit 24cd92f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+373
-220
lines changed

PythonLib/full/concurrent/futures/_base.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,11 @@ def done(self):
385385

386386
def __get_result(self):
387387
if self._exception:
388-
raise self._exception
388+
try:
389+
raise self._exception
390+
finally:
391+
# Break a reference cycle with the exception in self._exception
392+
self = None
389393
else:
390394
return self._result
391395

@@ -425,20 +429,24 @@ def result(self, timeout=None):
425429
timeout.
426430
Exception: If the call raised then that exception will be raised.
427431
"""
428-
with self._condition:
429-
if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
430-
raise CancelledError()
431-
elif self._state == FINISHED:
432-
return self.__get_result()
433-
434-
self._condition.wait(timeout)
435-
436-
if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
437-
raise CancelledError()
438-
elif self._state == FINISHED:
439-
return self.__get_result()
440-
else:
441-
raise TimeoutError()
432+
try:
433+
with self._condition:
434+
if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
435+
raise CancelledError()
436+
elif self._state == FINISHED:
437+
return self.__get_result()
438+
439+
self._condition.wait(timeout)
440+
441+
if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
442+
raise CancelledError()
443+
elif self._state == FINISHED:
444+
return self.__get_result()
445+
else:
446+
raise TimeoutError()
447+
finally:
448+
# Break a reference cycle with the exception in self._exception
449+
self = None
442450

443451
def exception(self, timeout=None):
444452
"""Return the exception raised by the call that the future represents.

PythonLib/full/ftplib.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class FTP:
104104
welcome = None
105105
passiveserver = 1
106106
encoding = "latin-1"
107+
# Disables https://bugs.python.org/issue43285 security if set to True.
108+
trust_server_pasv_ipv4_address = False
107109

108110
# Initialization method (called by class instantiation).
109111
# Initialize host to localhost, port to standard ftp port
@@ -316,8 +318,13 @@ def makeport(self):
316318
return sock
317319

318320
def makepasv(self):
321+
"""Internal: Does the PASV or EPSV handshake -> (address, port)"""
319322
if self.af == socket.AF_INET:
320-
host, port = parse227(self.sendcmd('PASV'))
323+
untrusted_host, port = parse227(self.sendcmd('PASV'))
324+
if self.trust_server_pasv_ipv4_address:
325+
host = untrusted_host
326+
else:
327+
host = self.sock.getpeername()[0]
321328
else:
322329
host, port = parse229(self.sendcmd('EPSV'), self.sock.getpeername())
323330
return host, port

PythonLib/full/gzip.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,7 @@ def main():
575575
g = sys.stdout.buffer
576576
else:
577577
if arg[-3:] != ".gz":
578-
print("filename doesn't end in .gz:", repr(arg))
579-
continue
578+
sys.exit(f"filename doesn't end in .gz: {arg!r}")
580579
f = open(arg, "rb")
581580
g = builtins.open(arg[:-3], "wb")
582581
else:

PythonLib/full/http/client.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,6 @@ def begin(self):
349349
# NOTE: RFC 2616, S4.4, #3 says we ignore this if tr_enc is "chunked"
350350
self.length = None
351351
length = self.headers.get("content-length")
352-
353-
# are we using the chunked-style of transfer encoding?
354-
tr_enc = self.headers.get("transfer-encoding")
355352
if length and not self.chunked:
356353
try:
357354
self.length = int(length)

PythonLib/full/idlelib/NEWS.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
What's New in IDLE 3.8.9
2+
Released on 2021-05-03?
3+
=========================
4+
5+
6+
bpo-43283: Document why printing to IDLE's Shell is often slower than
7+
printing to a system terminal and that it can be made faster by
8+
pre-formatting a single string before printing.
9+
110
What's New in IDLE 3.8.8
2-
Released on 2021-02-15?
11+
Released on 2021-02-19
312
======================================
413

5-
614
bpo-23544: Disable Debug=>Stack Viewer when user code is running or
715
Debugger is active, to prevent hang or crash. Patch by Zackery Spytz.
816

PythonLib/full/idlelib/help.html

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<head>
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>IDLE &#8212; Python 3.10.0a1 documentation</title>
8+
<title>IDLE &#8212; Python 3.10.0a6 documentation</title>
99
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
1010
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
1111

@@ -18,7 +18,7 @@
1818
<script src="../_static/sidebar.js"></script>
1919

2020
<link rel="search" type="application/opensearchdescription+xml"
21-
title="Search within Python 3.10.0a1 documentation"
21+
title="Search within Python 3.10.0a6 documentation"
2222
href="../_static/opensearch.xml"/>
2323
<link rel="author" title="About these documents" href="../about.html" />
2424
<link rel="index" title="Index" href="../genindex.html" />
@@ -32,7 +32,6 @@
3232

3333

3434

35-
3635
<style>
3736
@media only screen {
3837
table.full-width-table {
@@ -71,8 +70,8 @@ <h3>Navigation</h3>
7170
<li><a href="https://www.python.org/">Python</a> &#187;</li>
7271

7372

74-
<li>
75-
<a href="../index.html">3.10.0a1 Documentation</a> &#187;
73+
<li id="cpython-language-and-version">
74+
<a href="../index.html">3.10.0a6 Documentation</a> &#187;
7675
</li>
7776

7877
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -285,7 +284,7 @@ <h3>Shell menu (Shell window only)<a class="headerlink" href="#shell-menu-shell-
285284
<dl class="simple">
286285
<dt>View Last Restart</dt><dd><p>Scroll the shell window to the last Shell restart.</p>
287286
</dd>
288-
<dt>Restart Shell</dt><dd><p>Restart the shell to clean the environment.</p>
287+
<dt>Restart Shell</dt><dd><p>Restart the shell to clean the environment and reset display and exception handling.</p>
289288
</dd>
290289
<dt>Previous History</dt><dd><p>Cycle through earlier commands in history which match the current entry.</p>
291290
</dd>
@@ -633,8 +632,15 @@ <h3>Startup failure<a class="headerlink" href="#startup-failure" title="Permalin
633632
code execution process. A connection must be established whenever the Shell
634633
starts or restarts. (The latter is indicated by a divider line that says
635634
‘RESTART’). If the user process fails to connect to the GUI process, it
636-
displays a <code class="docutils literal notranslate"><span class="pre">Tk</span></code> error box with a ‘cannot connect’ message that directs the
637-
user here. It then exits.</p>
635+
usually displays a <code class="docutils literal notranslate"><span class="pre">Tk</span></code> error box with a ‘cannot connect’ message
636+
that directs the user here. It then exits.</p>
637+
<p>One specific connection failure on Unix systems results from
638+
misconfigured masquerading rules somewhere in a system’s network setup.
639+
When IDLE is started from a terminal, one will see a message starting
640+
with <code class="docutils literal notranslate"><span class="pre">**</span> <span class="pre">Invalid</span> <span class="pre">host:</span></code>.
641+
The valid value is <code class="docutils literal notranslate"><span class="pre">127.0.0.1</span> <span class="pre">(idlelib.rpc.LOCALHOST)</span></code>.
642+
One can diagnose with <code class="docutils literal notranslate"><span class="pre">tcpconnect</span> <span class="pre">-irv</span> <span class="pre">127.0.0.1</span> <span class="pre">6543</span></code> in one
643+
terminal window and <code class="docutils literal notranslate"><span class="pre">tcplisten</span> <span class="pre">&lt;same</span> <span class="pre">args&gt;</span></code> in another.</p>
638644
<p>A common cause of failure is a user-written file with the same name as a
639645
standard library module, such as <em>random.py</em> and <em>tkinter.py</em>. When such a
640646
file is located in the same directory as a file that is about to be run,
@@ -665,6 +671,12 @@ <h3>Startup failure<a class="headerlink" href="#startup-failure" title="Permalin
665671
<p>If IDLE quits with no message, and it was not started from a console, try
666672
starting it from a console or terminal (<code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">idlelib</span></code>) and see if
667673
this results in an error message.</p>
674+
<p>On Unix-based systems with tcl/tk older than <code class="docutils literal notranslate"><span class="pre">8.6.11</span></code> (see
675+
<code class="docutils literal notranslate"><span class="pre">About</span> <span class="pre">IDLE</span></code>) certain characters of certain fonts can cause
676+
a tk failure with a message to the terminal. This can happen either
677+
if one starts IDLE to edit a file with such a character or later
678+
when entering such a character. If one cannot upgrade tcl/tk,
679+
then re-configure IDLE to use a font that works better.</p>
668680
</div>
669681
<div class="section" id="running-user-code">
670682
<h3>Running user code<a class="headerlink" href="#running-user-code" title="Permalink to this headline"></a></h3>
@@ -680,24 +692,33 @@ <h3>Running user code<a class="headerlink" href="#running-user-code" title="Perm
680692
with objects that get input from and send output to the Shell window.
681693
The original values stored in <code class="docutils literal notranslate"><span class="pre">sys.__stdin__</span></code>, <code class="docutils literal notranslate"><span class="pre">sys.__stdout__</span></code>, and
682694
<code class="docutils literal notranslate"><span class="pre">sys.__stderr__</span></code> are not touched, but may be <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
683-
<p>When Shell has the focus, it controls the keyboard and screen. This is
684-
normally transparent, but functions that directly access the keyboard
685-
and screen will not work. These include system-specific functions that
686-
determine whether a key has been pressed and if so, which.</p>
695+
<p>Sending print output from one process to a text widget in another is
696+
slower than printing to a system terminal in the same process.
697+
This has the most effect when printing multiple arguments, as the string
698+
for each argument, each separator, the newline are sent separately.
699+
For development, this is usually not a problem, but if one wants to
700+
print faster in IDLE, format and join together everything one wants
701+
displayed together and then print a single string. Both format strings
702+
and <a class="reference internal" href="stdtypes.html#str.join" title="str.join"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.join()</span></code></a> can help combine fields and lines.</p>
687703
<p>IDLE’s standard stream replacements are not inherited by subprocesses
688-
created in the execution process, whether directly by user code or by modules
689-
such as multiprocessing. If such subprocess use <code class="docutils literal notranslate"><span class="pre">input</span></code> from sys.stdin
690-
or <code class="docutils literal notranslate"><span class="pre">print</span></code> or <code class="docutils literal notranslate"><span class="pre">write</span></code> to sys.stdout or sys.stderr,
704+
created in the execution process, whether directly by user code or by
705+
modules such as multiprocessing. If such subprocess use <code class="docutils literal notranslate"><span class="pre">input</span></code> from
706+
sys.stdin or <code class="docutils literal notranslate"><span class="pre">print</span></code> or <code class="docutils literal notranslate"><span class="pre">write</span></code> to sys.stdout or sys.stderr,
691707
IDLE should be started in a command line window. The secondary subprocess
692708
will then be attached to that window for input and output.</p>
693-
<p>The IDLE code running in the execution process adds frames to the call stack
694-
that would not be there otherwise. IDLE wraps <code class="docutils literal notranslate"><span class="pre">sys.getrecursionlimit</span></code> and
695-
<code class="docutils literal notranslate"><span class="pre">sys.setrecursionlimit</span></code> to reduce the effect of the additional stack frames.</p>
696709
<p>If <code class="docutils literal notranslate"><span class="pre">sys</span></code> is reset by user code, such as with <code class="docutils literal notranslate"><span class="pre">importlib.reload(sys)</span></code>,
697710
IDLE’s changes are lost and input from the keyboard and output to the screen
698711
will not work correctly.</p>
699-
<p>When user code raises SystemExit either directly or by calling sys.exit, IDLE
700-
returns to a Shell prompt instead of exiting.</p>
712+
<p>When Shell has the focus, it controls the keyboard and screen. This is
713+
normally transparent, but functions that directly access the keyboard
714+
and screen will not work. These include system-specific functions that
715+
determine whether a key has been pressed and if so, which.</p>
716+
<p>The IDLE code running in the execution process adds frames to the call stack
717+
that would not be there otherwise. IDLE wraps <code class="docutils literal notranslate"><span class="pre">sys.getrecursionlimit</span></code> and
718+
<code class="docutils literal notranslate"><span class="pre">sys.setrecursionlimit</span></code> to reduce the effect of the additional stack
719+
frames.</p>
720+
<p>When user code raises SystemExit either directly or by calling sys.exit,
721+
IDLE returns to a Shell prompt instead of exiting.</p>
701722
</div>
702723
<div class="section" id="user-output-in-shell">
703724
<h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title="Permalink to this headline"></a></h3>
@@ -949,8 +970,8 @@ <h3>Navigation</h3>
949970
<li><a href="https://www.python.org/">Python</a> &#187;</li>
950971

951972

952-
<li>
953-
<a href="../index.html">3.10.0a1 Documentation</a> &#187;
973+
<li id="cpython-language-and-version">
974+
<a href="../index.html">3.10.0a6 Documentation</a> &#187;
954975
</li>
955976

956977
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -974,15 +995,15 @@ <h3>Navigation</h3>
974995
</ul>
975996
</div>
976997
<div class="footer">
977-
&copy; <a href="../copyright.html">Copyright</a> 2001-2020, Python Software Foundation.
998+
&copy; <a href="../copyright.html">Copyright</a> 2001-2021, Python Software Foundation.
978999
<br />
9791000

9801001
The Python Software Foundation is a non-profit corporation.
9811002
<a href="https://www.python.org/psf/donations/">Please donate.</a>
9821003
<br />
9831004
<br />
9841005

985-
Last updated on Oct 20, 2020.
1006+
Last updated on Mar 29, 2021.
9861007
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
9871008
<br />
9881009

PythonLib/full/logging/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118

119119
def getLevelName(level):
120120
"""
121-
Return the textual representation of logging level 'level'.
121+
Return the textual or numeric representation of logging level 'level'.
122122
123123
If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
124124
INFO, DEBUG) then you get the corresponding string. If you have
@@ -128,7 +128,11 @@ def getLevelName(level):
128128
If a numeric value corresponding to one of the defined levels is passed
129129
in, the corresponding string representation is returned.
130130
131-
Otherwise, the string "Level %s" % level is returned.
131+
If a string representation of the level is passed in, the corresponding
132+
numeric value is returned.
133+
134+
If no matching numeric or string value is passed in, the string
135+
'Level %s' % level is returned.
132136
"""
133137
# See Issues #22386, #27937 and #29220 for why it's this way
134138
result = _levelToName.get(level)

PythonLib/full/pydoc.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,9 +2364,6 @@ def page(self, title, contents):
23642364
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
23652365
</body></html>''' % (title, css_link, html_navbar(), contents)
23662366

2367-
def filelink(self, url, path):
2368-
return '<a href="getfile?key=%s">%s</a>' % (url, path)
2369-
23702367

23712368
html = _HTMLDoc()
23722369

@@ -2452,19 +2449,6 @@ def bltinlink(name):
24522449
'key = %s' % key, '#ffffff', '#ee77aa', '<br>'.join(results))
24532450
return 'Search Results', contents
24542451

2455-
def html_getfile(path):
2456-
"""Get and display a source file listing safely."""
2457-
path = urllib.parse.unquote(path)
2458-
with tokenize.open(path) as fp:
2459-
lines = html.escape(fp.read())
2460-
body = '<pre>%s</pre>' % lines
2461-
heading = html.heading(
2462-
'<big><big><strong>File Listing</strong></big></big>',
2463-
'#ffffff', '#7799ee')
2464-
contents = heading + html.bigsection(
2465-
'File: %s' % path, '#ffffff', '#ee77aa', body)
2466-
return 'getfile %s' % path, contents
2467-
24682452
def html_topics():
24692453
"""Index of topic texts available."""
24702454

@@ -2556,8 +2540,6 @@ def get_html_page(url):
25562540
op, _, url = url.partition('=')
25572541
if op == "search?key":
25582542
title, content = html_search(url)
2559-
elif op == "getfile?key":
2560-
title, content = html_getfile(url)
25612543
elif op == "topic?key":
25622544
# try topics first, then objects.
25632545
try:

PythonLib/full/pydoc_data/topics.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Autogenerated by Sphinx on Fri Feb 19 11:26:48 2021
2+
# Autogenerated by Sphinx on Fri Apr 2 12:30:35 2021
33
topics = {'assert': 'The "assert" statement\n'
44
'**********************\n'
55
'\n'
@@ -5003,9 +5003,11 @@
50035003
'"Formatter",\n'
50045004
'subclasses can define their own format string syntax). The '
50055005
'syntax is\n'
5006-
'related to that of formatted string literals, but there '
5007-
'are\n'
5008-
'differences.\n'
5006+
'related to that of formatted string literals, but it is '
5007+
'less\n'
5008+
'sophisticated and, in particular, does not support '
5009+
'arbitrary\n'
5010+
'expressions.\n'
50095011
'\n'
50105012
'Format strings contain “replacement fields” surrounded by '
50115013
'curly braces\n'

PythonLib/full/shutil.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,12 @@ def move(src, dst, copy_function=copy2):
798798
if _destinsrc(src, dst):
799799
raise Error("Cannot move a directory '%s' into itself"
800800
" '%s'." % (src, dst))
801+
if (_is_immutable(src)
802+
or (not os.access(src, os.W_OK) and os.listdir(src)
803+
and sys.platform == 'darwin')):
804+
raise PermissionError("Cannot move the non-empty directory "
805+
"'%s': Lacking write permission to '%s'."
806+
% (src, src))
801807
copytree(src, real_dst, copy_function=copy_function,
802808
symlinks=True)
803809
rmtree(src)
@@ -815,6 +821,11 @@ def _destinsrc(src, dst):
815821
dst += os.path.sep
816822
return dst.startswith(src)
817823

824+
def _is_immutable(src):
825+
st = _stat(src)
826+
immutable_states = [stat.UF_IMMUTABLE, stat.SF_IMMUTABLE]
827+
return hasattr(st, 'st_flags') and st.st_flags in immutable_states
828+
818829
def _get_gid(name):
819830
"""Returns a gid, given a group name."""
820831
if getgrnam is None or name is None:

0 commit comments

Comments
 (0)