Skip to content

Commit 8316e83

Browse files
committed
updated to python 3.8.8
1 parent d37cffb commit 8316e83

File tree

111 files changed

+1020
-581
lines changed

Some content is hidden

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

111 files changed

+1020
-581
lines changed

PythonLib/full/base64.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def a85encode(b, *, foldspaces=False, wrapcol=0, pad=False, adobe=False):
320320
global _a85chars, _a85chars2
321321
# Delay the initialization of tables to not waste memory
322322
# if the function is never called
323-
if _a85chars is None:
323+
if _a85chars2 is None:
324324
_a85chars = [bytes((i,)) for i in range(33, 118)]
325325
_a85chars2 = [(a + b) for a in _a85chars for b in _a85chars]
326326

@@ -428,7 +428,7 @@ def b85encode(b, pad=False):
428428
global _b85chars, _b85chars2
429429
# Delay the initialization of tables to not waste memory
430430
# if the function is never called
431-
if _b85chars is None:
431+
if _b85chars2 is None:
432432
_b85chars = [bytes((i,)) for i in _b85alphabet]
433433
_b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
434434
return _85encode(b, _b85chars, _b85chars2, pad)

PythonLib/full/cProfile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,12 @@ def main():
191191
'__package__': None,
192192
'__cached__': None,
193193
}
194-
runctx(code, globs, None, options.outfile, options.sort)
194+
try:
195+
runctx(code, globs, None, options.outfile, options.sort)
196+
except BrokenPipeError as exc:
197+
# Prevent "Exception ignored" during interpreter shutdown.
198+
sys.stdout = None
199+
sys.exit(exc.errno)
195200
else:
196201
parser.print_usage()
197202
return parser

PythonLib/full/cgi.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ def closelog():
115115
# 0 ==> unlimited input
116116
maxlen = 0
117117

118-
def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
118+
def parse(fp=None, environ=os.environ, keep_blank_values=0,
119+
strict_parsing=0, separator='&'):
119120
"""Parse a query in the environment or from a file (default stdin)
120121
121122
Arguments, all optional:
@@ -134,6 +135,9 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
134135
strict_parsing: flag indicating what to do with parsing errors.
135136
If false (the default), errors are silently ignored.
136137
If true, errors raise a ValueError exception.
138+
139+
separator: str. The symbol to use for separating the query arguments.
140+
Defaults to &.
137141
"""
138142
if fp is None:
139143
fp = sys.stdin
@@ -154,7 +158,7 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
154158
if environ['REQUEST_METHOD'] == 'POST':
155159
ctype, pdict = parse_header(environ['CONTENT_TYPE'])
156160
if ctype == 'multipart/form-data':
157-
return parse_multipart(fp, pdict)
161+
return parse_multipart(fp, pdict, separator=separator)
158162
elif ctype == 'application/x-www-form-urlencoded':
159163
clength = int(environ['CONTENT_LENGTH'])
160164
if maxlen and clength > maxlen:
@@ -178,10 +182,10 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
178182
qs = ""
179183
environ['QUERY_STRING'] = qs # XXX Shouldn't, really
180184
return urllib.parse.parse_qs(qs, keep_blank_values, strict_parsing,
181-
encoding=encoding)
185+
encoding=encoding, separator=separator)
182186

183187

184-
def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"):
188+
def parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator='&'):
185189
"""Parse multipart input.
186190
187191
Arguments:
@@ -205,7 +209,7 @@ def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"):
205209
except KeyError:
206210
pass
207211
fs = FieldStorage(fp, headers=headers, encoding=encoding, errors=errors,
208-
environ={'REQUEST_METHOD': 'POST'})
212+
environ={'REQUEST_METHOD': 'POST'}, separator=separator)
209213
return {k: fs.getlist(k) for k in fs}
210214

211215
def _parseparam(s):
@@ -315,7 +319,7 @@ class FieldStorage:
315319
def __init__(self, fp=None, headers=None, outerboundary=b'',
316320
environ=os.environ, keep_blank_values=0, strict_parsing=0,
317321
limit=None, encoding='utf-8', errors='replace',
318-
max_num_fields=None):
322+
max_num_fields=None, separator='&'):
319323
"""Constructor. Read multipart/* until last part.
320324
321325
Arguments, all optional:
@@ -363,6 +367,7 @@ def __init__(self, fp=None, headers=None, outerboundary=b'',
363367
self.keep_blank_values = keep_blank_values
364368
self.strict_parsing = strict_parsing
365369
self.max_num_fields = max_num_fields
370+
self.separator = separator
366371
if 'REQUEST_METHOD' in environ:
367372
method = environ['REQUEST_METHOD'].upper()
368373
self.qs_on_post = None
@@ -589,7 +594,7 @@ def read_urlencoded(self):
589594
query = urllib.parse.parse_qsl(
590595
qs, self.keep_blank_values, self.strict_parsing,
591596
encoding=self.encoding, errors=self.errors,
592-
max_num_fields=self.max_num_fields)
597+
max_num_fields=self.max_num_fields, separator=self.separator)
593598
self.list = [MiniFieldStorage(key, value) for key, value in query]
594599
self.skip_lines()
595600

@@ -605,7 +610,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing):
605610
query = urllib.parse.parse_qsl(
606611
self.qs_on_post, self.keep_blank_values, self.strict_parsing,
607612
encoding=self.encoding, errors=self.errors,
608-
max_num_fields=self.max_num_fields)
613+
max_num_fields=self.max_num_fields, separator=self.separator)
609614
self.list.extend(MiniFieldStorage(key, value) for key, value in query)
610615

611616
klass = self.FieldStorageClass or self.__class__
@@ -649,7 +654,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing):
649654
else self.limit - self.bytes_read
650655
part = klass(self.fp, headers, ib, environ, keep_blank_values,
651656
strict_parsing, limit,
652-
self.encoding, self.errors, max_num_fields)
657+
self.encoding, self.errors, max_num_fields, self.separator)
653658

654659
if max_num_fields is not None:
655660
max_num_fields -= 1

PythonLib/full/ctypes/test/test_parameters.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,49 @@ def __dict__(self):
201201
with self.assertRaises(ZeroDivisionError):
202202
WorseStruct().__setstate__({}, b'foo')
203203

204+
def test_parameter_repr(self):
205+
from ctypes import (
206+
c_bool,
207+
c_char,
208+
c_wchar,
209+
c_byte,
210+
c_ubyte,
211+
c_short,
212+
c_ushort,
213+
c_int,
214+
c_uint,
215+
c_long,
216+
c_ulong,
217+
c_longlong,
218+
c_ulonglong,
219+
c_float,
220+
c_double,
221+
c_longdouble,
222+
c_char_p,
223+
c_wchar_p,
224+
c_void_p,
225+
)
226+
self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$")
227+
self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>")
228+
self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$")
229+
self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>")
230+
self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>")
231+
self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>")
232+
self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>")
233+
self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
234+
self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
235+
self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
236+
self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
237+
self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$")
238+
self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$")
239+
self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
240+
self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
241+
self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>")
242+
self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$")
243+
self.assertRegex(repr(c_char_p.from_param(b'hihi')), r"^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$")
244+
self.assertRegex(repr(c_wchar_p.from_param('hihi')), r"^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$")
245+
self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$")
246+
204247
################################################################
205248

206249
if __name__ == '__main__':

PythonLib/full/datetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ def _name_from_offset(delta):
23232323
# This is again a requirement for a sane tzinfo class.
23242324
#
23252325
# 4. (x+k).s = x.s
2326-
# This follows from #2, and that datimetimetz+timedelta preserves tzinfo.
2326+
# This follows from #2, and that datetime.timetz+timedelta preserves tzinfo.
23272327
#
23282328
# 5. (x+k).n = x.n + k
23292329
# Again follows from how arithmetic is defined.

PythonLib/full/fnmatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _compile_pattern(pat):
4646
return re.compile(res).match
4747

4848
def filter(names, pat):
49-
"""Return the subset of the list NAMES that match PAT."""
49+
"""Construct a list from those elements of the iterable NAMES that match PAT."""
5050
result = []
5151
pat = os.path.normcase(pat)
5252
match = _compile_pattern(pat)

PythonLib/full/html/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
|"[^"]*" # LIT-enclosed value
4848
|(?!['"])[^>\s]* # bare value
4949
)
50-
(?:\s*,)* # possibly followed by a comma
50+
\s* # possibly followed by a space
5151
)?(?:\s|/(?!>))*
5252
)*
5353
)?

PythonLib/full/idlelib/NEWS.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1-
What's New in IDLE 3.8.7
2-
Released on 2020-12-??
1+
What's New in IDLE 3.8.8
2+
Released on 2021-02-15?
33
======================================
44

55

6+
bpo-23544: Disable Debug=>Stack Viewer when user code is running or
7+
Debugger is active, to prevent hang or crash. Patch by Zackery Spytz.
8+
9+
bpo-43008: Make IDLE invoke :func:`sys.excepthook` in normal,
10+
2-process mode. Patch by Ken Hilton.
11+
12+
bpo-33065: Fix problem debugging user classes with __repr__ method.
13+
14+
bpo-32631: Finish zzdummy example extension module: make menu entries
15+
work; add docstrings and tests with 100% coverage.
16+
17+
bpo-42508: Keep IDLE running on macOS. Remove obsolete workaround
18+
that prevented running files with shortcuts when using new universal2
19+
installers built on macOS 11.
20+
21+
What's New in IDLE 3.8.7
22+
Released on 2020-12-27
23+
======================================
24+
625
bpo-42426: Fix reporting offset of the RE error in searchengine.
726

827
bpo-42416: Get docstrings for IDLE calltips more often

PythonLib/full/idlelib/codecontext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def toggle_code_context_event(self, event=None):
142142
self.text.after_cancel(self.t1)
143143
self._reset()
144144
menu_status = 'Show'
145-
self.editwin.update_menu_label(menu='options', index='* Code Context',
145+
self.editwin.update_menu_label(menu='options', index='*ode*ontext',
146146
label=f'{menu_status} Code Context')
147147
return "break"
148148

PythonLib/full/idlelib/configdialog.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END)
1919
from tkinter.ttk import (Frame, LabelFrame, Button, Checkbutton, Entry, Label,
2020
OptionMenu, Notebook, Radiobutton, Scrollbar, Style)
21-
import tkinter.colorchooser as tkColorChooser
22-
import tkinter.font as tkFont
21+
from tkinter import colorchooser
22+
import tkinter.font as tkfont
2323
from tkinter import messagebox
2424

2525
from idlelib.config import idleConf, ConfigChanges
@@ -609,7 +609,7 @@ def load_font_cfg(self):
609609
font_bold = configured_font[2]=='bold'
610610

611611
# Set sorted no-duplicate editor font selection list and font_name.
612-
fonts = sorted(set(tkFont.families(self)))
612+
fonts = sorted(set(tkfont.families(self)))
613613
for font in fonts:
614614
self.fontlist.insert(END, font)
615615
self.font_name.set(font_name)
@@ -663,7 +663,7 @@ def set_samples(self, event=None):
663663
Updates font_sample and highlight page highlight_sample.
664664
"""
665665
font_name = self.font_name.get()
666-
font_weight = tkFont.BOLD if self.font_bold.get() else tkFont.NORMAL
666+
font_weight = tkfont.BOLD if self.font_bold.get() else tkfont.NORMAL
667667
new_font = (font_name, self.font_size.get(), font_weight)
668668
self.font_sample['font'] = new_font
669669
self.highlight_sample['font'] = new_font
@@ -1100,7 +1100,7 @@ def get_color(self):
11001100
target = self.highlight_target.get()
11011101
prev_color = self.style.lookup(self.frame_color_set['style'],
11021102
'background')
1103-
rgbTuplet, color_string = tkColorChooser.askcolor(
1103+
rgbTuplet, color_string = colorchooser.askcolor(
11041104
parent=self, title='Pick new color for : '+target,
11051105
initialcolor=prev_color)
11061106
if color_string and (color_string != prev_color):
@@ -2316,7 +2316,15 @@ def detach(self):
23162316
23172317
Shell Preferences: Auto-Squeeze Min. Lines is the minimum number of lines
23182318
of output to automatically "squeeze".
2319-
'''
2319+
''',
2320+
'Extensions': '''
2321+
ZzDummy: This extension is provided as an example for how to create and
2322+
use an extension. Enable indicates whether the extension is active or
2323+
not; likewise enable_editor and enable_shell indicate which windows it
2324+
will be active on. For this extension, z-text is the text that will be
2325+
inserted at or removed from the beginning of the lines of selected text,
2326+
or the current line if no selection.
2327+
''',
23202328
}
23212329

23222330

0 commit comments

Comments
 (0)