Skip to content

Commit fe53458

Browse files
authored
Merge branch '3.13' into backport-c39ae89-3.13
2 parents 73f520d + 247c3b2 commit fe53458

23 files changed

+201
-86
lines changed

Android/android-env.sh

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# This script must be sourced with the following variables already set:
2-
: ${ANDROID_HOME:?} # Path to Android SDK
3-
: ${HOST:?} # GNU target triplet
2+
: "${ANDROID_HOME:?}" # Path to Android SDK
3+
: "${HOST:?}" # GNU target triplet
44

55
# You may also override the following:
6-
: ${api_level:=21} # Minimum Android API level the build will run on
7-
: ${PREFIX:-} # Path in which to find required libraries
6+
: "${api_level:=21}" # Minimum Android API level the build will run on
7+
: "${PREFIX:-}" # Path in which to find required libraries
88

99

1010
# Print all messages on stderr so they're visible when running within build-wheel.
@@ -27,20 +27,20 @@ fail() {
2727
ndk_version=27.1.12297006
2828

2929
ndk=$ANDROID_HOME/ndk/$ndk_version
30-
if ! [ -e $ndk ]; then
30+
if ! [ -e "$ndk" ]; then
3131
log "Installing NDK - this may take several minutes"
32-
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "ndk;$ndk_version"
32+
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;$ndk_version"
3333
fi
3434

35-
if [ $HOST = "arm-linux-androideabi" ]; then
35+
if [ "$HOST" = "arm-linux-androideabi" ]; then
3636
clang_triplet=armv7a-linux-androideabi
3737
else
38-
clang_triplet=$HOST
38+
clang_triplet="$HOST"
3939
fi
4040

4141
# These variables are based on BuildSystemMaintainers.md above, and
4242
# $ndk/build/cmake/android.toolchain.cmake.
43-
toolchain=$(echo $ndk/toolchains/llvm/prebuilt/*)
43+
toolchain=$(echo "$ndk"/toolchains/llvm/prebuilt/*)
4444
export AR="$toolchain/bin/llvm-ar"
4545
export AS="$toolchain/bin/llvm-as"
4646
export CC="$toolchain/bin/${clang_triplet}${api_level}-clang"
@@ -72,12 +72,12 @@ LDFLAGS="$LDFLAGS -lm"
7272

7373
# -mstackrealign is included where necessary in the clang launcher scripts which are
7474
# pointed to by $CC, so we don't need to include it here.
75-
if [ $HOST = "arm-linux-androideabi" ]; then
75+
if [ "$HOST" = "arm-linux-androideabi" ]; then
7676
CFLAGS="$CFLAGS -march=armv7-a -mthumb"
7777
fi
7878

7979
if [ -n "${PREFIX:-}" ]; then
80-
abs_prefix=$(realpath $PREFIX)
80+
abs_prefix="$(realpath "$PREFIX")"
8181
CFLAGS="$CFLAGS -I$abs_prefix/include"
8282
LDFLAGS="$LDFLAGS -L$abs_prefix/lib"
8383

@@ -87,11 +87,13 @@ fi
8787

8888
# When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will
8989
# use CXXFLAGS alone.
90-
export CXXFLAGS=$CFLAGS
90+
export CXXFLAGS="$CFLAGS"
9191

9292
# Use the same variable name as conda-build
93-
if [ $(uname) = "Darwin" ]; then
94-
export CPU_COUNT=$(sysctl -n hw.ncpu)
93+
if [ "$(uname)" = "Darwin" ]; then
94+
CPU_COUNT="$(sysctl -n hw.ncpu)"
95+
export CPU_COUNT
9596
else
96-
export CPU_COUNT=$(nproc)
97+
CPU_COUNT="$(nproc)"
98+
export CPU_COUNT
9799
fi

Doc/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,6 @@
552552
r'https://github.com/python/cpython/tree/.*': 'https://github.com/python/cpython/blob/.*',
553553
# Intentional HTTP use at Misc/NEWS.d/3.5.0a1.rst
554554
r'http://www.python.org/$': 'https://www.python.org/$',
555-
# Used in license page, keep as is
556-
r'https://www.zope.org/': r'https://www.zope.dev/',
557555
# Microsoft's redirects to learn.microsoft.com
558556
r'https://msdn.microsoft.com/.*': 'https://learn.microsoft.com/.*',
559557
r'https://docs.microsoft.com/.*': 'https://learn.microsoft.com/.*',

Doc/tools/extensions/pyspecific.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,32 +96,6 @@ def run(self):
9696
return [pnode]
9797

9898

99-
# Support for documenting decorators
100-
101-
class PyDecoratorMixin(object):
102-
def handle_signature(self, sig, signode):
103-
ret = super(PyDecoratorMixin, self).handle_signature(sig, signode)
104-
signode.insert(0, addnodes.desc_addname('@', '@'))
105-
return ret
106-
107-
def needs_arglist(self):
108-
return False
109-
110-
111-
class PyDecoratorFunction(PyDecoratorMixin, PyFunction):
112-
def run(self):
113-
# a decorator function is a function after all
114-
self.name = 'py:function'
115-
return PyFunction.run(self)
116-
117-
118-
# TODO: Use sphinx.domains.python.PyDecoratorMethod when possible
119-
class PyDecoratorMethod(PyDecoratorMixin, PyMethod):
120-
def run(self):
121-
self.name = 'py:method'
122-
return PyMethod.run(self)
123-
124-
12599
class PyCoroutineMixin(object):
126100
def handle_signature(self, sig, signode):
127101
ret = super(PyCoroutineMixin, self).handle_signature(sig, signode)
@@ -359,8 +333,6 @@ def setup(app):
359333
app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature)
360334
app.add_object_type('pdbcommand', 'pdbcmd', '%s (pdb command)', parse_pdb_command)
361335
app.add_object_type('monitoring-event', 'monitoring-event', '%s (monitoring event)', parse_monitoring_event)
362-
app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction)
363-
app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod)
364336
app.add_directive_to_domain('py', 'coroutinefunction', PyCoroutineFunction)
365337
app.add_directive_to_domain('py', 'coroutinemethod', PyCoroutineMethod)
366338
app.add_directive_to_domain('py', 'awaitablefunction', PyAwaitableFunction)

Doc/whatsnew/3.13.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,8 +1508,20 @@ All of the following modules were deprecated in Python 3.11,
15081508
and are now removed:
15091509

15101510
* :mod:`!aifc`
1511+
1512+
* :pypi:`standard-aifc`:
1513+
Use the redistribution of ``aifc`` library from PyPI.
1514+
15111515
* :mod:`!audioop`
1516+
1517+
* :pypi:`audioop-lts`:
1518+
Use ``audioop-lts`` library from PyPI.
1519+
15121520
* :mod:`!chunk`
1521+
1522+
* :pypi:`standard-chunk`:
1523+
Use the redistribution of ``chunk`` library from PyPI.
1524+
15131525
* :mod:`!cgi` and :mod:`!cgitb`
15141526

15151527
* :class:`!cgi.FieldStorage` can typically be replaced with
@@ -1540,6 +1552,9 @@ and are now removed:
15401552
For example, the :class:`email.message.EmailMessage`
15411553
and :class:`email.message.Message` classes.
15421554

1555+
* :pypi:`standard-cgi`: and :pypi:`standard-cgitb`:
1556+
Use the redistribution of ``cgi`` and ``cgitb`` library from PyPI.
1557+
15431558
* :mod:`!crypt` and the private :mod:`!_crypt` extension.
15441559
The :mod:`hashlib` module may be an appropriate replacement
15451560
when simply hashing a value is required.
@@ -1558,37 +1573,74 @@ and are now removed:
15581573
Fork of the :mod:`!crypt` module,
15591574
wrapper to the :manpage:`crypt_r(3)` library call
15601575
and associated functionality.
1576+
* :pypi:`standard-crypt` and :pypi:`deprecated-crypt-alternative`:
1577+
Use the redistribution of ``crypt`` and reimplementation of ``_crypt`` libraries from PyPI.
15611578

15621579
* :mod:`!imghdr`:
15631580
The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic` libraries
15641581
should be used as replacements.
15651582
For example, the :func:`!puremagic.what` function can be used
15661583
to replace the :func:`!imghdr.what` function for all file formats
15671584
that were supported by :mod:`!imghdr`.
1585+
1586+
* :pypi:`standard-imghdr`:
1587+
Use the redistribution of ``imghdr`` library from PyPI.
1588+
15681589
* :mod:`!mailcap`:
15691590
Use the :mod:`mimetypes` module instead.
1591+
1592+
* :pypi:`standard-mailcap`:
1593+
Use the redistribution of ``mailcap`` library from PyPI.
1594+
15701595
* :mod:`!msilib`
15711596
* :mod:`!nis`
15721597
* :mod:`!nntplib`:
15731598
Use the :pypi:`pynntp` library from PyPI instead.
1599+
1600+
* :pypi:`standard-nntplib`:
1601+
Use the redistribution of ``nntplib`` library from PyPI.
1602+
15741603
* :mod:`!ossaudiodev`:
15751604
For audio playback, use the :pypi:`pygame` library from PyPI instead.
15761605
* :mod:`!pipes`:
15771606
Use the :mod:`subprocess` module instead.
15781607
Use :func:`shlex.quote` to replace the undocumented ``pipes.quote``
15791608
function.
1609+
1610+
* :pypi:`standard-pipes`:
1611+
Use the redistribution of ``pipes`` library from PyPI.
1612+
15801613
* :mod:`!sndhdr`:
15811614
The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic` libraries
15821615
should be used as replacements.
1616+
1617+
* :pypi:`standard-sndhdr`:
1618+
Use the redistribution of ``sndhdr`` library from PyPI.
1619+
15831620
* :mod:`!spwd`:
15841621
Use the :pypi:`python-pam` library from PyPI instead.
15851622
* :mod:`!sunau`
1623+
1624+
* :pypi:`standard-sunau`:
1625+
Use the redistribution of ``sunau`` library from PyPI.
1626+
15861627
* :mod:`!telnetlib`,
15871628
Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries from PyPI instead.
1629+
1630+
* :pypi:`standard-telnetlib`:
1631+
Use the redistribution of ``telnetlib`` library from PyPI.
1632+
15881633
* :mod:`!uu`:
15891634
Use the :mod:`base64` module instead, as a modern alternative.
1635+
1636+
* :pypi:`standard-uu`:
1637+
Use the redistribution of ``uu`` library from PyPI.
1638+
15901639
* :mod:`!xdrlib`
15911640

1641+
* :pypi:`standard-xdrlib`:
1642+
Use the redistribution of ``xdrlib`` library from PyPI.
1643+
15921644
(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:`104780`.)
15931645

15941646

Lib/_colorize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def can_colorize(*, file=None) -> bool:
4040
return False
4141
if os.environ.get("PYTHON_COLORS") == "1":
4242
return True
43-
if "NO_COLOR" in os.environ:
43+
if os.environ.get("NO_COLOR"):
4444
return False
4545
if not COLORIZE:
4646
return False
47-
if "FORCE_COLOR" in os.environ:
47+
if os.environ.get("FORCE_COLOR"):
4848
return True
4949
if os.environ.get("TERM") == "dumb":
5050
return False

Lib/idlelib/idle_test/test_configdialog.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from idlelib import configdialog
66
from test.support import requires
77
requires('gui')
8+
from test.support.testcase import ExtraAssertions
89
import unittest
910
from unittest import mock
1011
from idlelib.idle_test.mock_idle import Func
@@ -59,7 +60,7 @@ def activate_config_changes(self):
5960
pass
6061

6162

62-
class ButtonTest(unittest.TestCase):
63+
class ButtonTest(unittest.TestCase, ExtraAssertions):
6364

6465
def test_click_ok(self):
6566
d = dialog
@@ -98,8 +99,8 @@ def test_click_help(self):
9899
dialog.buttons['Help'].invoke()
99100
title, contents = view.kwds['title'], view.kwds['contents']
100101
self.assertEqual(title, 'Help for IDLE preferences')
101-
self.assertTrue(contents.startswith('When you click') and
102-
contents.endswith('a different name.\n'))
102+
self.assertStartsWith(contents, 'When you click')
103+
self.assertEndsWith(contents,'a different name.\n')
103104

104105

105106
class FontPageTest(unittest.TestCase):

Lib/idlelib/idle_test/test_debugger.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from tkinter import Tk
1010

1111
from test.support import requires
12+
from test.support.testcase import ExtraAssertions
1213
import unittest
1314
from unittest import mock
1415
from unittest.mock import Mock, patch
@@ -227,7 +228,7 @@ def test_show_stack_with_frame(self):
227228
self.idb.get_stack.assert_called_once_with(test_frame, None)
228229

229230

230-
class StackViewerTest(unittest.TestCase):
231+
class StackViewerTest(unittest.TestCase, ExtraAssertions):
231232

232233
@classmethod
233234
def setUpClass(cls):
@@ -256,7 +257,7 @@ def test_init(self):
256257
flist = None
257258
master_window = self.root
258259
sv = debugger.StackViewer(master_window, flist, gui)
259-
self.assertTrue(hasattr(sv, 'stack'))
260+
self.assertHasAttr(sv, 'stack')
260261

261262
def test_load_stack(self):
262263
# Test the .load_stack() method against a fixed test stack.

Lib/idlelib/idle_test/test_grep.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from idlelib import grep
99
import unittest
1010
from test.support import captured_stdout
11+
from test.support.testcase import ExtraAssertions
1112
from idlelib.idle_test.mock_tk import Var
1213
import os
1314
import re
@@ -115,7 +116,7 @@ def test_recurse(self):
115116
self.assertIn(self.realpath, filelist)
116117

117118

118-
class Grep_itTest(unittest.TestCase):
119+
class Grep_itTest(unittest.TestCase, ExtraAssertions):
119120
# Test captured reports with 0 and some hits.
120121
# Should test file names, but Windows reports have mixed / and \ separators
121122
# from incomplete replacement, so 'later'.
@@ -143,7 +144,7 @@ def test_found(self):
143144
self.assertIn(pat, lines[0])
144145
self.assertIn('py: 1:', lines[1]) # line number 1
145146
self.assertIn('2', lines[3]) # hits found 2
146-
self.assertTrue(lines[4].startswith('(Hint:'))
147+
self.assertStartsWith(lines[4], '(Hint:')
147148

148149

149150
class Default_commandTest(unittest.TestCase):

Lib/idlelib/idle_test/test_multicall.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
from idlelib import multicall
44
import unittest
55
from test.support import requires
6+
from test.support.testcase import ExtraAssertions
67
from tkinter import Tk, Text
78

89

9-
class MultiCallTest(unittest.TestCase):
10+
class MultiCallTest(unittest.TestCase, ExtraAssertions):
1011

1112
@classmethod
1213
def setUpClass(cls):
@@ -27,7 +28,7 @@ def tearDownClass(cls):
2728
def test_creator(self):
2829
mc = self.mc
2930
self.assertIs(multicall._multicall_dict[Text], mc)
30-
self.assertTrue(issubclass(mc, Text))
31+
self.assertIsSubclass(mc, Text)
3132
mc2 = multicall.MultiCallCreator(Text)
3233
self.assertIs(mc, mc2)
3334

Lib/idlelib/idle_test/test_query.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from idlelib import query
1313
import unittest
1414
from test.support import requires
15+
from test.support.testcase import ExtraAssertions
1516
from tkinter import Tk, END
1617

1718
import sys
@@ -105,7 +106,7 @@ def test_good_section_name(self):
105106
self.assertEqual(dialog.entry_error['text'], '')
106107

107108

108-
class ModuleNameTest(unittest.TestCase):
109+
class ModuleNameTest(unittest.TestCase, ExtraAssertions):
109110
"Test ModuleName subclass of Query."
110111

111112
class Dummy_ModuleName:
@@ -134,10 +135,10 @@ def test_c_source_name(self):
134135

135136
def test_good_module_name(self):
136137
dialog = self.Dummy_ModuleName('idlelib')
137-
self.assertTrue(dialog.entry_ok().endswith('__init__.py'))
138+
self.assertEndsWith(dialog.entry_ok(), '__init__.py')
138139
self.assertEqual(dialog.entry_error['text'], '')
139140
dialog = self.Dummy_ModuleName('idlelib.idle')
140-
self.assertTrue(dialog.entry_ok().endswith('idle.py'))
141+
self.assertEndsWith(dialog.entry_ok(), 'idle.py')
141142
self.assertEqual(dialog.entry_error['text'], '')
142143

143144

@@ -376,7 +377,7 @@ def test_click_section_name(self):
376377
root.destroy()
377378

378379

379-
class ModulenameGuiTest(unittest.TestCase):
380+
class ModulenameGuiTest(unittest.TestCase, ExtraAssertions):
380381

381382
@classmethod
382383
def setUpClass(cls):
@@ -389,7 +390,7 @@ def test_click_module_name(self):
389390
self.assertEqual(dialog.text0, 'idlelib')
390391
self.assertEqual(dialog.entry.get(), 'idlelib')
391392
dialog.button_ok.invoke()
392-
self.assertTrue(dialog.result.endswith('__init__.py'))
393+
self.assertEndsWith(dialog.result, '__init__.py')
393394
root.destroy()
394395

395396

0 commit comments

Comments
 (0)