Skip to content

Commit

Permalink
Merge branch 'main' into supermon
Browse files Browse the repository at this point in the history
* 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)
  ...
  • Loading branch information
carljm committed May 15, 2023
2 parents 9de351f + b378d99 commit 343867a
Show file tree
Hide file tree
Showing 69 changed files with 1,775 additions and 1,379 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"
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ jobs:
# failing when executed from inside a virtual environment.
${{ env.VENV_PYTHON }} -m test \
-W \
-o \
-j4 \
-x test_asyncio \
-x test_multiprocessing_fork \
-x test_multiprocessing_forkserver \
Expand Down
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
5 changes: 1 addition & 4 deletions Doc/library/collections.abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

.. testsetup:: *

import warnings
# Ignore warning when ByteString is imported
with warnings.catch_warnings(action='ignore', category=DeprecationWarning):
from collections.abc import *
from collections.abc import *
import itertools
__name__ = '<doctest>'

Expand Down
7 changes: 7 additions & 0 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ are always available. They are listed here in alphabetical order.
If :func:`sys.breakpointhook` is not accessible, this function will
raise :exc:`RuntimeError`.

By default, the behavior of :func:`breakpoint` can be changed with
the :envvar:`PYTHONBREAKPOINT` environment variable.
See :func:`sys.breakpointhook` for usage details.

Note that this is not guaranteed if :func:`sys.breakpointhook`
has been replaced.

.. audit-event:: builtins.breakpoint breakpointhook breakpoint

.. versionadded:: 3.7
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
10 changes: 6 additions & 4 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

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


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

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


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

.. _typing-constrained-typevar:

Using a *constrained* type variable, however, means that the ``TypeVar``
can only ever be solved as being exactly one of the constraints given::

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

.. data:: AnyStr

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

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

Abstract Base Classes
---------------------
Expand Down
6 changes: 4 additions & 2 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ Pending Removal in Python 3.14
For use in typing, prefer a union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`.
(Contributed by Shantanu Jain in :gh:`91896`.)

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

* Creating immutable types (:data:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
bases using the C API.
Expand Down 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
9 changes: 0 additions & 9 deletions Lib/collections/abc.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias

_deprecated_ByteString = globals().pop("ByteString")

def __getattr__(attr):
if attr == "ByteString":
import warnings
warnings._deprecated("collections.abc.ByteString", remove=(3, 14))
return _deprecated_ByteString
raise AttributeError(f"module 'collections.abc' has no attribute {attr!r}")
4 changes: 4 additions & 0 deletions Lib/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ def parse_request(self):
# - Leading zeros MUST be ignored by recipients.
if len(version_number) != 2:
raise ValueError
if any(not component.isdigit() for component in version_number):
raise ValueError("non digit in http version")
if any(len(component) > 10 for component in version_number):
raise ValueError("unreasonable length http version")
version_number = int(version_number[0]), int(version_number[1])
except (ValueError, IndexError):
self.send_error(
Expand Down
15 changes: 13 additions & 2 deletions Lib/idlelib/NEWS.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
What's New in IDLE 3.12.0
(since 3.11.0)
Released on 2023-10-02
=========================


gh-88496 Fix IDLE test hang on macOS.

gh-103314 Support sys.last_exc after exceptions in Shell.
Patch by Irit Katriel.


What's New in IDLE 3.11.0
(since 3.10.0)
Released on 2022-10-03
Released on 2022-10-24
=========================


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

0 comments on commit 343867a

Please sign in to comment.