Skip to content

Commit

Permalink
updated to python 3.8.8
Browse files Browse the repository at this point in the history
  • Loading branch information
chcg committed Feb 20, 2021
1 parent d37cffb commit 8316e83
Show file tree
Hide file tree
Showing 111 changed files with 1,020 additions and 581 deletions.
4 changes: 2 additions & 2 deletions PythonLib/full/base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def a85encode(b, *, foldspaces=False, wrapcol=0, pad=False, adobe=False):
global _a85chars, _a85chars2
# Delay the initialization of tables to not waste memory
# if the function is never called
if _a85chars is None:
if _a85chars2 is None:
_a85chars = [bytes((i,)) for i in range(33, 118)]
_a85chars2 = [(a + b) for a in _a85chars for b in _a85chars]

Expand Down Expand Up @@ -428,7 +428,7 @@ def b85encode(b, pad=False):
global _b85chars, _b85chars2
# Delay the initialization of tables to not waste memory
# if the function is never called
if _b85chars is None:
if _b85chars2 is None:
_b85chars = [bytes((i,)) for i in _b85alphabet]
_b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
return _85encode(b, _b85chars, _b85chars2, pad)
Expand Down
7 changes: 6 additions & 1 deletion PythonLib/full/cProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ def main():
'__package__': None,
'__cached__': None,
}
runctx(code, globs, None, options.outfile, options.sort)
try:
runctx(code, globs, None, options.outfile, options.sort)
except BrokenPipeError as exc:
# Prevent "Exception ignored" during interpreter shutdown.
sys.stdout = None
sys.exit(exc.errno)
else:
parser.print_usage()
return parser
Expand Down
23 changes: 14 additions & 9 deletions PythonLib/full/cgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def closelog():
# 0 ==> unlimited input
maxlen = 0

def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
def parse(fp=None, environ=os.environ, keep_blank_values=0,
strict_parsing=0, separator='&'):
"""Parse a query in the environment or from a file (default stdin)
Arguments, all optional:
Expand All @@ -134,6 +135,9 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
strict_parsing: flag indicating what to do with parsing errors.
If false (the default), errors are silently ignored.
If true, errors raise a ValueError exception.
separator: str. The symbol to use for separating the query arguments.
Defaults to &.
"""
if fp is None:
fp = sys.stdin
Expand All @@ -154,7 +158,7 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
if environ['REQUEST_METHOD'] == 'POST':
ctype, pdict = parse_header(environ['CONTENT_TYPE'])
if ctype == 'multipart/form-data':
return parse_multipart(fp, pdict)
return parse_multipart(fp, pdict, separator=separator)
elif ctype == 'application/x-www-form-urlencoded':
clength = int(environ['CONTENT_LENGTH'])
if maxlen and clength > maxlen:
Expand All @@ -178,10 +182,10 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
qs = ""
environ['QUERY_STRING'] = qs # XXX Shouldn't, really
return urllib.parse.parse_qs(qs, keep_blank_values, strict_parsing,
encoding=encoding)
encoding=encoding, separator=separator)


def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"):
def parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator='&'):
"""Parse multipart input.
Arguments:
Expand All @@ -205,7 +209,7 @@ def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"):
except KeyError:
pass
fs = FieldStorage(fp, headers=headers, encoding=encoding, errors=errors,
environ={'REQUEST_METHOD': 'POST'})
environ={'REQUEST_METHOD': 'POST'}, separator=separator)
return {k: fs.getlist(k) for k in fs}

def _parseparam(s):
Expand Down Expand Up @@ -315,7 +319,7 @@ class FieldStorage:
def __init__(self, fp=None, headers=None, outerboundary=b'',
environ=os.environ, keep_blank_values=0, strict_parsing=0,
limit=None, encoding='utf-8', errors='replace',
max_num_fields=None):
max_num_fields=None, separator='&'):
"""Constructor. Read multipart/* until last part.
Arguments, all optional:
Expand Down Expand Up @@ -363,6 +367,7 @@ def __init__(self, fp=None, headers=None, outerboundary=b'',
self.keep_blank_values = keep_blank_values
self.strict_parsing = strict_parsing
self.max_num_fields = max_num_fields
self.separator = separator
if 'REQUEST_METHOD' in environ:
method = environ['REQUEST_METHOD'].upper()
self.qs_on_post = None
Expand Down Expand Up @@ -589,7 +594,7 @@ def read_urlencoded(self):
query = urllib.parse.parse_qsl(
qs, self.keep_blank_values, self.strict_parsing,
encoding=self.encoding, errors=self.errors,
max_num_fields=self.max_num_fields)
max_num_fields=self.max_num_fields, separator=self.separator)
self.list = [MiniFieldStorage(key, value) for key, value in query]
self.skip_lines()

Expand All @@ -605,7 +610,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing):
query = urllib.parse.parse_qsl(
self.qs_on_post, self.keep_blank_values, self.strict_parsing,
encoding=self.encoding, errors=self.errors,
max_num_fields=self.max_num_fields)
max_num_fields=self.max_num_fields, separator=self.separator)
self.list.extend(MiniFieldStorage(key, value) for key, value in query)

klass = self.FieldStorageClass or self.__class__
Expand Down Expand Up @@ -649,7 +654,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing):
else self.limit - self.bytes_read
part = klass(self.fp, headers, ib, environ, keep_blank_values,
strict_parsing, limit,
self.encoding, self.errors, max_num_fields)
self.encoding, self.errors, max_num_fields, self.separator)

if max_num_fields is not None:
max_num_fields -= 1
Expand Down
43 changes: 43 additions & 0 deletions PythonLib/full/ctypes/test/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,49 @@ def __dict__(self):
with self.assertRaises(ZeroDivisionError):
WorseStruct().__setstate__({}, b'foo')

def test_parameter_repr(self):
from ctypes import (
c_bool,
c_char,
c_wchar,
c_byte,
c_ubyte,
c_short,
c_ushort,
c_int,
c_uint,
c_long,
c_ulong,
c_longlong,
c_ulonglong,
c_float,
c_double,
c_longdouble,
c_char_p,
c_wchar_p,
c_void_p,
)
self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$")
self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>")
self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$")
self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>")
self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>")
self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>")
self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>")
self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$")
self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$")
self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>")
self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$")
self.assertRegex(repr(c_char_p.from_param(b'hihi')), r"^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$")
self.assertRegex(repr(c_wchar_p.from_param('hihi')), r"^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$")
self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$")

################################################################

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion PythonLib/full/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2323,7 +2323,7 @@ def _name_from_offset(delta):
# This is again a requirement for a sane tzinfo class.
#
# 4. (x+k).s = x.s
# This follows from #2, and that datimetimetz+timedelta preserves tzinfo.
# This follows from #2, and that datetime.timetz+timedelta preserves tzinfo.
#
# 5. (x+k).n = x.n + k
# Again follows from how arithmetic is defined.
Expand Down
2 changes: 1 addition & 1 deletion PythonLib/full/fnmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _compile_pattern(pat):
return re.compile(res).match

def filter(names, pat):
"""Return the subset of the list NAMES that match PAT."""
"""Construct a list from those elements of the iterable NAMES that match PAT."""
result = []
pat = os.path.normcase(pat)
match = _compile_pattern(pat)
Expand Down
2 changes: 1 addition & 1 deletion PythonLib/full/html/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
|"[^"]*" # LIT-enclosed value
|(?!['"])[^>\s]* # bare value
)
(?:\s*,)* # possibly followed by a comma
\s* # possibly followed by a space
)?(?:\s|/(?!>))*
)*
)?
Expand Down
23 changes: 21 additions & 2 deletions PythonLib/full/idlelib/NEWS.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
What's New in IDLE 3.8.7
Released on 2020-12-??
What's New in IDLE 3.8.8
Released on 2021-02-15?
======================================


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

bpo-43008: Make IDLE invoke :func:`sys.excepthook` in normal,
2-process mode. Patch by Ken Hilton.

bpo-33065: Fix problem debugging user classes with __repr__ method.

bpo-32631: Finish zzdummy example extension module: make menu entries
work; add docstrings and tests with 100% coverage.

bpo-42508: Keep IDLE running on macOS. Remove obsolete workaround
that prevented running files with shortcuts when using new universal2
installers built on macOS 11.

What's New in IDLE 3.8.7
Released on 2020-12-27
======================================

bpo-42426: Fix reporting offset of the RE error in searchengine.

bpo-42416: Get docstrings for IDLE calltips more often
Expand Down
2 changes: 1 addition & 1 deletion PythonLib/full/idlelib/codecontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def toggle_code_context_event(self, event=None):
self.text.after_cancel(self.t1)
self._reset()
menu_status = 'Show'
self.editwin.update_menu_label(menu='options', index='* Code Context',
self.editwin.update_menu_label(menu='options', index='*ode*ontext',
label=f'{menu_status} Code Context')
return "break"

Expand Down
20 changes: 14 additions & 6 deletions PythonLib/full/idlelib/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END)
from tkinter.ttk import (Frame, LabelFrame, Button, Checkbutton, Entry, Label,
OptionMenu, Notebook, Radiobutton, Scrollbar, Style)
import tkinter.colorchooser as tkColorChooser
import tkinter.font as tkFont
from tkinter import colorchooser
import tkinter.font as tkfont
from tkinter import messagebox

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

# Set sorted no-duplicate editor font selection list and font_name.
fonts = sorted(set(tkFont.families(self)))
fonts = sorted(set(tkfont.families(self)))
for font in fonts:
self.fontlist.insert(END, font)
self.font_name.set(font_name)
Expand Down Expand Up @@ -663,7 +663,7 @@ def set_samples(self, event=None):
Updates font_sample and highlight page highlight_sample.
"""
font_name = self.font_name.get()
font_weight = tkFont.BOLD if self.font_bold.get() else tkFont.NORMAL
font_weight = tkfont.BOLD if self.font_bold.get() else tkfont.NORMAL
new_font = (font_name, self.font_size.get(), font_weight)
self.font_sample['font'] = new_font
self.highlight_sample['font'] = new_font
Expand Down Expand Up @@ -1100,7 +1100,7 @@ def get_color(self):
target = self.highlight_target.get()
prev_color = self.style.lookup(self.frame_color_set['style'],
'background')
rgbTuplet, color_string = tkColorChooser.askcolor(
rgbTuplet, color_string = colorchooser.askcolor(
parent=self, title='Pick new color for : '+target,
initialcolor=prev_color)
if color_string and (color_string != prev_color):
Expand Down Expand Up @@ -2316,7 +2316,15 @@ def detach(self):
Shell Preferences: Auto-Squeeze Min. Lines is the minimum number of lines
of output to automatically "squeeze".
'''
''',
'Extensions': '''
ZzDummy: This extension is provided as an example for how to create and
use an extension. Enable indicates whether the extension is active or
not; likewise enable_editor and enable_shell indicate which windows it
will be active on. For this extension, z-text is the text that will be
inserted at or removed from the beginning of the lines of selected text,
or the current line if no selection.
''',
}


Expand Down
6 changes: 3 additions & 3 deletions PythonLib/full/idlelib/debugger_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
barrier, in particular frame and traceback objects.
"""

import reprlib
import types
from idlelib import debugger

Expand Down Expand Up @@ -170,7 +170,7 @@ def dict_keys_list(self, did):
def dict_item(self, did, key):
dict = dicttable[did]
value = dict[key]
value = repr(value) ### can't pickle module 'builtins'
value = reprlib.repr(value) ### can't pickle module 'builtins'
return value

#----------end class IdbAdapter----------
Expand Down Expand Up @@ -390,4 +390,4 @@ def restart_subprocess_debugger(rpcclt):

if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_debugger', verbosity=2, exit=False)
main('idlelib.idle_test.test_debugger_r', verbosity=2, exit=False)
Loading

0 comments on commit 8316e83

Please sign in to comment.