Skip to content

Commit 343867a

Browse files
committed
Merge branch 'main' into supermon
* main: (29 commits) pythongh-101819: Fix _io clinic input for unused base class method stubs (python#104418) pythongh-101819: Isolate `_io` (python#101948) Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (python#104501) pythongh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (python#104495) pythongh-104050: Run mypy on `clinic.py` in CI (python#104421) pythongh-104490: Consistently define phony make targets (python#104491) pythongh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (python#104473) pythongh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (python#104488) pythongh-101282: move BOLT config after PGO (pythongh-104493) pythongh-104469 Convert _testcapi/float.c to use AC (pythongh-104470) pythongh-104456: Fix ref leak in _ctypes.COMError (python#104457) pythongh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (python#104474) pythongh-104337: Clarify random.gammavariate doc entry (python#104410) Minor improvements to typing docs (python#104465) pythongh-87092: avoid gcc warning on uninitialized struct field in assemble.c (python#104460) pythonGH-71383: IDLE - Document testing subsets of modules (python#104463) pythongh-104454: Fix refleak in AttributeError_reduce (python#104455) pythongh-75710: IDLE - add docstrings and comments to editor module (python#104446) pythongh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (python#104424) Add a mention of PYTHONBREAKPOINT to breakpoint() docs (python#104430) ...
2 parents 9de351f + b378d99 commit 343867a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1775
-1379
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/build.yml

+2
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ jobs:
377377
# failing when executed from inside a virtual environment.
378378
${{ env.VENV_PYTHON }} -m test \
379379
-W \
380+
-o \
381+
-j4 \
380382
-x test_asyncio \
381383
-x test_multiprocessing_fork \
382384
-x test_multiprocessing_forkserver \

.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/collections.abc.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414

1515
.. testsetup:: *
1616

17-
import warnings
18-
# Ignore warning when ByteString is imported
19-
with warnings.catch_warnings(action='ignore', category=DeprecationWarning):
20-
from collections.abc import *
17+
from collections.abc import *
2118
import itertools
2219
__name__ = '<doctest>'
2320

Doc/library/functions.rst

+7
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ are always available. They are listed here in alphabetical order.
168168
If :func:`sys.breakpointhook` is not accessible, this function will
169169
raise :exc:`RuntimeError`.
170170

171+
By default, the behavior of :func:`breakpoint` can be changed with
172+
the :envvar:`PYTHONBREAKPOINT` environment variable.
173+
See :func:`sys.breakpointhook` for usage details.
174+
175+
Note that this is not guaranteed if :func:`sys.breakpointhook`
176+
has been replaced.
177+
171178
.. audit-event:: builtins.breakpoint breakpointhook breakpoint
172179

173180
.. versionadded:: 3.7

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/library/typing.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
This module provides runtime support for type hints. The most fundamental
2121
support consists of the types :data:`Any`, :data:`Union`, :data:`Callable`,
22-
:class:`TypeVar`, and :class:`Generic`. For a full specification, please see
22+
:class:`TypeVar`, and :class:`Generic`. For a specification, please see
2323
:pep:`484`. For a simplified introduction to type hints, see :pep:`483`.
2424

2525

@@ -592,7 +592,7 @@ The module defines the following classes, functions and decorators.
592592
when the checked program targets Python 3.9 or newer.
593593

594594
The deprecated types will be removed from the :mod:`typing` module
595-
in the first Python version released 5 years after the release of Python 3.9.0.
595+
no sooner than the first Python version released 5 years after the release of Python 3.9.0.
596596
See details in :pep:`585`—*Type Hinting Generics In Standard Collections*.
597597

598598

@@ -1291,6 +1291,8 @@ These are not used in annotations. They are building blocks for creating generic
12911291
U = TypeVar('U', bound=str|bytes) # Can be any subtype of the union str|bytes
12921292
V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method
12931293

1294+
.. _typing-constrained-typevar:
1295+
12941296
Using a *constrained* type variable, however, means that the ``TypeVar``
12951297
can only ever be solved as being exactly one of the constraints given::
12961298

@@ -1550,7 +1552,7 @@ These are not used in annotations. They are building blocks for creating generic
15501552

15511553
.. data:: AnyStr
15521554

1553-
``AnyStr`` is a :class:`constrained type variable <TypeVar>` defined as
1555+
``AnyStr`` is a :ref:`constrained type variable <typing-constrained-typevar>` defined as
15541556
``AnyStr = TypeVar('AnyStr', str, bytes)``.
15551557

15561558
It is meant to be used for functions that may accept any kind of string
@@ -2112,7 +2114,7 @@ Other concrete types
21122114
Python 2 is no longer supported, and most type checkers also no longer
21132115
support type checking Python 2 code. Removal of the alias is not
21142116
currently planned, but users are encouraged to use
2115-
:class:`str` instead of ``Text`` wherever possible.
2117+
:class:`str` instead of ``Text``.
21162118

21172119
Abstract Base Classes
21182120
---------------------

Doc/whatsnew/3.12.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,8 @@ Pending Removal in Python 3.14
831831
For use in typing, prefer a union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`.
832832
(Contributed by Shantanu Jain in :gh:`91896`.)
833833

834-
* :class:`typing.ByteString`, deprecated since Python 3.9, now causes an
835-
:exc:`DeprecationWarning` to be emitted when it is used or accessed.
834+
* :class:`typing.ByteString`, deprecated since Python 3.9, now causes a
835+
:exc:`DeprecationWarning` to be emitted when it is used.
836836

837837
* Creating immutable types (:data:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
838838
bases using the C API.
@@ -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/collections/abc.py

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
from _collections_abc import *
22
from _collections_abc import __all__
33
from _collections_abc import _CallableGenericAlias
4-
5-
_deprecated_ByteString = globals().pop("ByteString")
6-
7-
def __getattr__(attr):
8-
if attr == "ByteString":
9-
import warnings
10-
warnings._deprecated("collections.abc.ByteString", remove=(3, 14))
11-
return _deprecated_ByteString
12-
raise AttributeError(f"module 'collections.abc' has no attribute {attr!r}")

Lib/http/server.py

+4
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ def parse_request(self):
300300
# - Leading zeros MUST be ignored by recipients.
301301
if len(version_number) != 2:
302302
raise ValueError
303+
if any(not component.isdigit() for component in version_number):
304+
raise ValueError("non digit in http version")
305+
if any(len(component) > 10 for component in version_number):
306+
raise ValueError("unreasonable length http version")
303307
version_number = int(version_number[0]), int(version_number[1])
304308
except (ValueError, IndexError):
305309
self.send_error(

Lib/idlelib/NEWS.txt

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1+
What's New in IDLE 3.12.0
2+
(since 3.11.0)
3+
Released on 2023-10-02
4+
=========================
5+
6+
7+
gh-88496 Fix IDLE test hang on macOS.
8+
9+
gh-103314 Support sys.last_exc after exceptions in Shell.
10+
Patch by Irit Katriel.
11+
12+
113
What's New in IDLE 3.11.0
214
(since 3.10.0)
3-
Released on 2022-10-03
15+
Released on 2022-10-24
416
=========================
517

6-
718
gh-97527: Fix a bug in the previous bugfix that caused IDLE to not
819
start when run with 3.10.8, 3.12.0a1, and at least Microsoft Python
920
3.10.2288.0 installed without the Lib/test package. 3.11.0 was never

0 commit comments

Comments
 (0)