Skip to content

Commit 5c9dd40

Browse files
committed
Merge branch 'fix-issue-97556' of https://github.com/apccurtiss/cpython into fix-issue-97556
2 parents b704f7e + c48ec29 commit 5c9dd40

20 files changed

Lines changed: 490 additions & 354 deletions

‎Doc/includes/email-read-alternative.py‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@
88
from email import policy
99
from email.parser import BytesParser
1010

11-
# An imaginary module that would make this work and be safe.
12-
from imaginary import magic_html_parser
11+
12+
def magic_html_parser(html_text, partfiles):
13+
"""Return safety-sanitized html linked to partfiles.
14+
15+
Rewrite the href="cid:...." attributes to point to the filenames in partfiles.
16+
Though not trivial, this should be possible using html.parser.
17+
"""
18+
raise NotImplementedError("Add the magic needed")
19+
1320

1421
# In a real program you'd get the filename from the arguments.
1522
with open('outgoing.msg', 'rb') as fp:
@@ -62,9 +69,6 @@
6269
print("Don't know how to display {}".format(richest.get_content_type()))
6370
sys.exit()
6471
with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:
65-
# The magic_html_parser has to rewrite the href="cid:...." attributes to
66-
# point to the filenames in partfiles. It also has to do a safety-sanitize
67-
# of the html. It could be written using html.parser.
6872
f.write(magic_html_parser(body.get_content(), partfiles))
6973
webbrowser.open(f.name)
7074
os.remove(f.name)

‎LICENSE‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ A. HISTORY OF THE SOFTWARE
22
==========================
33

44
Python was created in the early 1990s by Guido van Rossum at Stichting
5-
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
5+
Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
66
as a successor of a language called ABC. Guido remains Python's
77
principal author, although it includes many contributions from others.
88

99
In 1995, Guido continued his work on Python at the Corporation for
10-
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
10+
National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
1111
in Reston, Virginia where he released several versions of the
1212
software.
1313

@@ -19,7 +19,7 @@ https://www.python.org/psf/) was formed, a non-profit organization
1919
created specifically to own Python-related Intellectual Property.
2020
Zope Corporation was a sponsoring member of the PSF.
2121

22-
All Python releases are Open Source (see http://www.opensource.org for
22+
All Python releases are Open Source (see https://opensource.org for
2323
the Open Source Definition). Historically, most, but not all, Python
2424
releases have also been GPL-compatible; the table below summarizes
2525
the various releases.

‎Lib/idlelib/macosx.py‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from os.path import expanduser
55
import plistlib
66
from sys import platform # Used in _init_tk_type, changed by test.
7+
from test.support import requires, ResourceDenied
78

89
import tkinter
910

@@ -14,23 +15,26 @@
1415
_tk_type = None
1516

1617
def _init_tk_type():
17-
"""
18-
Initializes OS X Tk variant values for
19-
isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().
18+
""" Initialize _tk_type for isXyzTk functions.
2019
"""
2120
global _tk_type
2221
if platform == 'darwin':
23-
root = tkinter.Tk()
24-
ws = root.tk.call('tk', 'windowingsystem')
25-
if 'x11' in ws:
26-
_tk_type = "xquartz"
27-
elif 'aqua' not in ws:
28-
_tk_type = "other"
29-
elif 'AppKit' in root.tk.call('winfo', 'server', '.'):
30-
_tk_type = "cocoa"
22+
try:
23+
requires('gui')
24+
except ResourceDenied: # Possible when testing.
25+
_tk_type = "cocoa" # Newest and most common.
3126
else:
32-
_tk_type = "carbon"
33-
root.destroy()
27+
root = tkinter.Tk()
28+
ws = root.tk.call('tk', 'windowingsystem')
29+
if 'x11' in ws:
30+
_tk_type = "xquartz"
31+
elif 'aqua' not in ws:
32+
_tk_type = "other"
33+
elif 'AppKit' in root.tk.call('winfo', 'server', '.'):
34+
_tk_type = "cocoa"
35+
else:
36+
_tk_type = "carbon"
37+
root.destroy()
3438
else:
3539
_tk_type = "other"
3640

‎Lib/test/support/bytecode_helper.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def get_disassembly_as_string(self, co):
1717

1818
def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):
1919
"""Returns instr if opname is found, otherwise throws AssertionError"""
20+
self.assertIn(opname, dis.opmap)
2021
for instr in dis.get_instructions(x):
2122
if instr.opname == opname:
2223
if argval is _UNSPECIFIED or instr.argval == argval:
@@ -31,6 +32,7 @@ def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):
3132

3233
def assertNotInBytecode(self, x, opname, argval=_UNSPECIFIED):
3334
"""Throws AssertionError if opname is found"""
35+
self.assertIn(opname, dis.opmap)
3436
for instr in dis.get_instructions(x):
3537
if instr.opname == opname:
3638
disassembly = self.get_disassembly_as_string(x)

‎Lib/test/test_cmd_line.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,8 @@ def test_int_max_str_digits(self):
871871
assert_python_failure('-X', 'int_max_str_digits', '-c', code)
872872
assert_python_failure('-X', 'int_max_str_digits=foo', '-c', code)
873873
assert_python_failure('-X', 'int_max_str_digits=100', '-c', code)
874+
assert_python_failure('-X', 'int_max_str_digits', '-c', code,
875+
PYTHONINTMAXSTRDIGITS='4000')
874876

875877
assert_python_failure('-c', code, PYTHONINTMAXSTRDIGITS='foo')
876878
assert_python_failure('-c', code, PYTHONINTMAXSTRDIGITS='100')

‎Lib/test/test_ctypes/test_callbacks.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import functools
23
import unittest
34
from test import support
@@ -150,6 +151,18 @@ def __del__(self):
150151
gc.collect()
151152
CFUNCTYPE(None)(lambda x=Nasty(): None)
152153

154+
@need_symbol('WINFUNCTYPE')
155+
def test_i38748_stackCorruption(self):
156+
callback_funcType = WINFUNCTYPE(c_long, c_long, c_longlong)
157+
@callback_funcType
158+
def callback(a, b):
159+
c = a + b
160+
print(f"a={a}, b={b}, c={c}")
161+
return c
162+
dll = cdll[_ctypes_test.__file__]
163+
# With no fix for i38748, the next line will raise OSError and cause the test to fail.
164+
self.assertEqual(dll._test_i38748_runCallback(callback, 5, 10), 15)
165+
153166

154167
@need_symbol('WINFUNCTYPE')
155168
class StdcallCallbacks(Callbacks):

‎Lib/test/test_struct.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,20 @@ def test__struct_types_immutable(self):
700700
with self.assertRaises(TypeError):
701701
cls.x = 1
702702

703+
@support.cpython_only
704+
def test__struct_Struct__new__initialized(self):
705+
# See https://github.com/python/cpython/issues/78724
706+
707+
s = struct.Struct.__new__(struct.Struct, "b")
708+
s.unpack_from(b"abcd")
709+
710+
@support.cpython_only
711+
def test__struct_Struct_subclassing(self):
712+
class Bob(struct.Struct):
713+
pass
714+
715+
s = Bob("b")
716+
s.unpack_from(b"abcd")
703717

704718
def test_issue35714(self):
705719
# Embedded null characters should not be allowed in format strings.

‎Mac/BuildScript/resources/License.rtf‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
HISTORY OF THE SOFTWARE\
1313
1414
\f1\b0 \ulnone \
15-
Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands as a successor of a language called ABC. Guido remains Python's principal author, although it includes many contributions from others.\
15+
Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands as a successor of a language called ABC. Guido remains Python's principal author, although it includes many contributions from others.\
1616
\
17-
In 1995, Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) in Reston, Virginia where he released several versions of the software.\
17+
In 1995, Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) in Reston, Virginia where he released several versions of the software.\
1818
\
19-
In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same year, the PythonLabs team moved to Digital Creations (now Zope Corporation, see http://www.zope.org). In 2001, the Python Software Foundation (PSF, see https://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF.\
19+
In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same year, the PythonLabs team moved to Digital Creations (now Zope Corporation, see https://www.zope.dev). In 2001, the Python Software Foundation (PSF, see https://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF.\
2020
\
21-
All Python releases are Open Source (see http://www.opensource.org for the Open Source Definition). Historically, most, but not all, Python releases have also been GPL-compatible; the table below summarizes the various releases.\
21+
All Python releases are Open Source (see https://opensource.org for the Open Source Definition). Historically, most, but not all, Python releases have also been GPL-compatible; the table below summarizes the various releases.\
2222
\
2323

2424
\f2\b Release Derived Year Owner GPL-\

‎Misc/HISTORY‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19610,7 +19610,7 @@ durable way. For example, some people say they're confused by that
1961019610
the Open Source Initiative's entry for the Python Software Foundation
1961119611
License::
1961219612

19613-
http://www.opensource.org/licenses/PythonSoftFoundation.php
19613+
https://opensource.org/licenses/PythonSoftFoundation.php
1961419614

1961519615
says "Python 2.1.1" all over it, wondering whether it applies only
1961619616
to Python 2.1.1.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The ``PyLong_FromString`` function was refactored to make it more maintainable
2+
and extensible.

0 commit comments

Comments
 (0)