Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into tvobject
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed May 15, 2023
2 parents b93f85e + b378d99 commit f412f49
Show file tree
Hide file tree
Showing 37 changed files with 952 additions and 787 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ updates:
update-types:
- "version-update:semver-minor"
- "version-update:semver-patch"
- package-ecosystem: "pip"
directory: "/Tools/clinic/"
schedule:
interval: "monthly"
labels:
- "skip issue"
- "skip news"
39 changes: 39 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Workflow to run mypy on select parts of the CPython repo
name: mypy

on:
push:
branches:
- main
pull_request:
paths:
- "Tools/clinic/**"
- ".github/workflows/mypy.yml"
workflow_dispatch:

permissions:
contents: read

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
FORCE_COLOR: 1
TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
mypy:
name: Run mypy on Tools/clinic/
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
cache: pip
cache-dependency-path: Tools/clinic/requirements-dev.txt
- run: pip install -r Tools/clinic/requirements-dev.txt
- run: mypy --config-file Tools/clinic/mypy.ini
3 changes: 3 additions & 0 deletions Doc/library/atexit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ at interpreter termination time they will be run in the order ``C``, ``B``,
program is killed by a signal not handled by Python, when a Python fatal
internal error is detected, or when :func:`os._exit` is called.

**Note:** The effect of registering or unregistering functions from within
a cleanup function is undefined.

.. versionchanged:: 3.7
When used with C-API subinterpreters, registered functions
are local to the interpreter they were registered in.
Expand Down
9 changes: 6 additions & 3 deletions Doc/library/random.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,10 @@ be found in any statistics text.

.. function:: gammavariate(alpha, beta)

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

The probability distribution function is::

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

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

Normal distribution, also called the Gaussian distribution. *mu* is the mean,
Normal distribution, also called the Gaussian distribution.
*mu* is the mean,
and *sigma* is the standard deviation. This is slightly faster than
the :func:`normalvariate` function defined below.

Expand Down
2 changes: 2 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,8 @@ Build Changes

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

* ``PYTHON_FOR_REGEN`` now require Python 3.10 or newer.


C API Changes
=============
Expand Down
3 changes: 2 additions & 1 deletion Lib/asyncio/sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ def abort(self):
called with None as its argument.
"""
self._closed = True
self._ssl_protocol._abort()
if self._ssl_protocol is not None:
self._ssl_protocol._abort()

def _force_close(self, exc):
self._closed = True
Expand Down
7 changes: 5 additions & 2 deletions Lib/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4242,6 +4242,7 @@ def test_warn_on_dealloc_fd(self):

def test_pickling(self):
# Pickling file objects is forbidden
msg = "cannot pickle"
for kwargs in [
{"mode": "w"},
{"mode": "wb"},
Expand All @@ -4256,8 +4257,10 @@ def test_pickling(self):
if "b" not in kwargs["mode"]:
kwargs["encoding"] = "utf-8"
for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
with self.open(os_helper.TESTFN, **kwargs) as f:
self.assertRaises(TypeError, pickle.dumps, f, protocol)
with self.subTest(protocol=protocol, kwargs=kwargs):
with self.open(os_helper.TESTFN, **kwargs) as f:
with self.assertRaisesRegex(TypeError, msg):
pickle.dumps(f, protocol)

@unittest.skipIf(
support.is_emscripten, "fstat() of a pipe fd is not supported"
Expand Down
10 changes: 6 additions & 4 deletions Lib/test/test_tkinter/test_geometry_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def test_pack_configure_in(self):
a.pack_configure(in_=c)
self.assertEqual(pack.pack_slaves(), [b, c, d])
self.assertEqual(c.pack_slaves(), [a])
with self.assertRaisesRegex(TclError,
'can\'t pack %s inside itself' % (a,)):
with self.assertRaisesRegex(
TclError, """can't pack "?%s"? inside itself""" % (a,)):
a.pack_configure(in_=a)
with self.assertRaisesRegex(TclError, 'bad window path name ".foo"'):
a.pack_configure(in_='.foo')
Expand Down Expand Up @@ -292,8 +292,10 @@ def create2(self):
def test_place_configure_in(self):
t, f, f2 = self.create2()
self.assertEqual(f2.winfo_manager(), '')
with self.assertRaisesRegex(TclError, "can't place %s relative to "
"itself" % re.escape(str(f2))):
with self.assertRaisesRegex(
TclError,
"""can't place "?%s"? relative to itself"""
% re.escape(str(f2))):
f2.place_configure(in_=f2)
self.assertEqual(f2.winfo_manager(), '')
with self.assertRaisesRegex(TclError, 'bad window path name'):
Expand Down
Loading

0 comments on commit f412f49

Please sign in to comment.