Skip to content

Commit f412f49

Browse files
committed
Merge remote-tracking branch 'upstream/main' into tvobject
2 parents b93f85e + b378d99 commit f412f49

37 files changed

+952
-787
lines changed

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ updates:
1212
update-types:
1313
- "version-update:semver-minor"
1414
- "version-update:semver-patch"
15+
- package-ecosystem: "pip"
16+
directory: "/Tools/clinic/"
17+
schedule:
18+
interval: "monthly"
19+
labels:
20+
- "skip issue"
21+
- "skip news"

.github/workflows/mypy.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Workflow to run mypy on select parts of the CPython repo
2+
name: mypy
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
paths:
10+
- "Tools/clinic/**"
11+
- ".github/workflows/mypy.yml"
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
env:
18+
PIP_DISABLE_PIP_VERSION_CHECK: 1
19+
FORCE_COLOR: 1
20+
TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
mypy:
28+
name: Run mypy on Tools/clinic/
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 10
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-python@v4
34+
with:
35+
python-version: "3.x"
36+
cache: pip
37+
cache-dependency-path: Tools/clinic/requirements-dev.txt
38+
- run: pip install -r Tools/clinic/requirements-dev.txt
39+
- run: mypy --config-file Tools/clinic/mypy.ini

Doc/library/atexit.rst

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ at interpreter termination time they will be run in the order ``C``, ``B``,
2020
program is killed by a signal not handled by Python, when a Python fatal
2121
internal error is detected, or when :func:`os._exit` is called.
2222

23+
**Note:** The effect of registering or unregistering functions from within
24+
a cleanup function is undefined.
25+
2326
.. versionchanged:: 3.7
2427
When used with C-API subinterpreters, registered functions
2528
are local to the interpreter they were registered in.

Doc/library/random.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,10 @@ be found in any statistics text.
334334

335335
.. function:: gammavariate(alpha, beta)
336336

337-
Gamma distribution. (*Not* the gamma function!) Conditions on the
338-
parameters are ``alpha > 0`` and ``beta > 0``.
337+
Gamma distribution. (*Not* the gamma function!) The shape and
338+
scale parameters, *alpha* and *beta*, must have positive values.
339+
(Calling conventions vary and some sources define 'beta'
340+
as the inverse of the scale).
339341

340342
The probability distribution function is::
341343

@@ -346,7 +348,8 @@ be found in any statistics text.
346348

347349
.. function:: gauss(mu=0.0, sigma=1.0)
348350

349-
Normal distribution, also called the Gaussian distribution. *mu* is the mean,
351+
Normal distribution, also called the Gaussian distribution.
352+
*mu* is the mean,
350353
and *sigma* is the standard deviation. This is slightly faster than
351354
the :func:`normalvariate` function defined below.
352355

Doc/whatsnew/3.12.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,8 @@ Build Changes
12041204

12051205
(Contributed by Zhang Na in :gh:`90656`.)
12061206

1207+
* ``PYTHON_FOR_REGEN`` now require Python 3.10 or newer.
1208+
12071209

12081210
C API Changes
12091211
=============

Lib/asyncio/sslproto.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ def abort(self):
244244
called with None as its argument.
245245
"""
246246
self._closed = True
247-
self._ssl_protocol._abort()
247+
if self._ssl_protocol is not None:
248+
self._ssl_protocol._abort()
248249

249250
def _force_close(self, exc):
250251
self._closed = True

Lib/test/test_io.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -4242,6 +4242,7 @@ def test_warn_on_dealloc_fd(self):
42424242

42434243
def test_pickling(self):
42444244
# Pickling file objects is forbidden
4245+
msg = "cannot pickle"
42454246
for kwargs in [
42464247
{"mode": "w"},
42474248
{"mode": "wb"},
@@ -4256,8 +4257,10 @@ def test_pickling(self):
42564257
if "b" not in kwargs["mode"]:
42574258
kwargs["encoding"] = "utf-8"
42584259
for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
4259-
with self.open(os_helper.TESTFN, **kwargs) as f:
4260-
self.assertRaises(TypeError, pickle.dumps, f, protocol)
4260+
with self.subTest(protocol=protocol, kwargs=kwargs):
4261+
with self.open(os_helper.TESTFN, **kwargs) as f:
4262+
with self.assertRaisesRegex(TypeError, msg):
4263+
pickle.dumps(f, protocol)
42614264

42624265
@unittest.skipIf(
42634266
support.is_emscripten, "fstat() of a pipe fd is not supported"

Lib/test/test_tkinter/test_geometry_managers.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def test_pack_configure_in(self):
108108
a.pack_configure(in_=c)
109109
self.assertEqual(pack.pack_slaves(), [b, c, d])
110110
self.assertEqual(c.pack_slaves(), [a])
111-
with self.assertRaisesRegex(TclError,
112-
'can\'t pack %s inside itself' % (a,)):
111+
with self.assertRaisesRegex(
112+
TclError, """can't pack "?%s"? inside itself""" % (a,)):
113113
a.pack_configure(in_=a)
114114
with self.assertRaisesRegex(TclError, 'bad window path name ".foo"'):
115115
a.pack_configure(in_='.foo')
@@ -292,8 +292,10 @@ def create2(self):
292292
def test_place_configure_in(self):
293293
t, f, f2 = self.create2()
294294
self.assertEqual(f2.winfo_manager(), '')
295-
with self.assertRaisesRegex(TclError, "can't place %s relative to "
296-
"itself" % re.escape(str(f2))):
295+
with self.assertRaisesRegex(
296+
TclError,
297+
"""can't place "?%s"? relative to itself"""
298+
% re.escape(str(f2))):
297299
f2.place_configure(in_=f2)
298300
self.assertEqual(f2.winfo_manager(), '')
299301
with self.assertRaisesRegex(TclError, 'bad window path name'):

0 commit comments

Comments
 (0)