Skip to content

Commit 127d4ba

Browse files
authored
Merge branch 'main' into fix-unittest-loader-abc-testcase
2 parents f2f0fa4 + 460dec2 commit 127d4ba

39 files changed

Lines changed: 244 additions & 77 deletions

.github/workflows/reusable-san.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ jobs:
8686
run: >-
8787
./python -m test
8888
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
89-
-j4 -W
89+
-j4 -W --timeout=900 --slowest
9090
- name: Parallel tests
9191
if: >-
9292
inputs.sanitizer == 'TSan'
9393
&& fromJSON(inputs.free-threading)
94-
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4 -W
94+
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4 -W --timeout=600 --slowest
9595
- name: Display logs
9696
if: always()
9797
run: find "${GITHUB_WORKSPACE}" -name 'san_log.*' | xargs head -n 1000

.pre-commit-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: e05c5c0818279e5ac248ac9e954431ba58865e61 # frozen: v0.15.7
3+
rev: 3b3f7c3f57fe9925356faf5fe6230835138be230 # frozen: v0.15.17
44
hooks:
55
- id: ruff-check
66
name: Run Ruff (lint) on Platforms/Apple/
@@ -10,6 +10,11 @@ repos:
1010
name: Run Ruff (lint) on Doc/
1111
args: [--exit-non-zero-on-fix]
1212
files: ^Doc/
13+
- id: ruff-check
14+
name: Run Ruff (lint) on Lib/
15+
args: [--exit-non-zero-on-fix]
16+
files: ^Lib/
17+
exclude: ^Lib/test/
1318
- id: ruff-check
1419
name: Run Ruff (lint) on Lib/test/
1520
args: [--exit-non-zero-on-fix]
@@ -18,6 +23,11 @@ repos:
1823
name: Run Ruff (lint) on Platforms/WASI/
1924
args: [--exit-non-zero-on-fix, --config=Platforms/WASI/.ruff.toml]
2025
files: ^Platforms/WASI/
26+
- id: ruff-check
27+
name: Run Ruff (lint) on Tools/
28+
args: [--exit-non-zero-on-fix]
29+
files: ^Tools/
30+
exclude: ^Tools/(build|clinic|i18n|peg_generator|wasm)/
2131
- id: ruff-check
2232
name: Run Ruff (lint) on Tools/build/
2333
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]

Doc/c-api/init_config.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,10 @@ Some options are read from the :mod:`sys` attributes. For example, the option
623623
624624
.. versionadded:: 3.14
625625
626+
.. versionchanged:: next
627+
The function now replaces :data:`sys.flags` (create a new object),
628+
instead of modifying :data:`sys.flags` in-place.
629+
626630
627631
.. _pyconfig_api:
628632

Include/internal/pycore_critical_section.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,9 @@ _PyCriticalSection2_Begin(PyThreadState *tstate, PyCriticalSection2 *c, PyObject
196196
static inline void
197197
_PyCriticalSection2_End(PyThreadState *tstate, PyCriticalSection2 *c)
198198
{
199-
// if mutex1 is NULL, we used the fast path in
200-
// _PyCriticalSection_BeginSlow for mutexes that are already held,
201-
// which should only happen when mutex1 and mutex2 were the same mutex,
202-
// and mutex2 should also be NULL.
199+
// if mutex1 is NULL, we used the fast path in either
200+
// _PyCriticalSection_BeginSlow or _PyCriticalSection2_BeginSlow for mutexes
201+
// that are already held, and mutex2 should also be NULL.
203202
if (c->_cs_base._cs_mutex == NULL) {
204203
assert(c->_cs_mutex2 == NULL);
205204
return;

Lib/.ruff.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
extend = "../.ruff.toml" # Inherit the project-wide settings
2+
3+
# Unlike Tools/, stdlib can use newer syntax than PYTHON_FOR_REGEN
4+
target-version = "py315"
5+
6+
[lint]
7+
select = [
8+
"F401", # Unused import
9+
]
10+
11+
[lint.per-file-ignores]
12+
"ctypes/__init__.py" = ["F401"] # Re-exports from _ctypes
13+
"ensurepip/__init__.py" = ["F401"] # `import zlib` availability check
14+
"idlelib/idle_test/htest.py" = ["F401"] # Import for Windows DPI side effect
15+
"idlelib/idle_test/test_iomenu.py" = ["F401"] # Imports checked for existence
16+
"importlib/_abc.py" = ["F401"] # Bootstrap-sensitive _bootstrap import
17+
"importlib/machinery.py" = ["F401"] # NamespacePath re-export
18+
"importlib/metadata/__init__.py" = ["F401"] # Synced from importlib_metadata
19+
"profiling/sampling/sample.py" = ["F401"] # Re-exports PROFILING_MODE_* constants
20+
"ssl.py" = ["F401"] # Re-exports from _ssl
21+
"warnings.py" = ["F401"] # Re-exports from _py_warnings

Lib/_pyrepl/completing_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# types
3333
Command = commands.Command
3434
if TYPE_CHECKING:
35-
from .types import CommandName, CompletionAction, Keymap, KeySpec
35+
from .types import CompletionAction, Keymap
3636

3737

3838
def prefix(wordlist: list[str], j: int = 0) -> str:

Lib/_pyrepl/reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
)
3939
from .layout import LayoutMap, LayoutResult, LayoutRow, WrappedRow, layout_content_lines
4040
from .render import RenderCell, RenderLine, RenderedScreen, ScreenOverlay
41-
from .utils import ANSI_ESCAPE_SEQUENCE, ColorSpan, THEME, StyleRef, wlen, gen_colors
41+
from .utils import ANSI_ESCAPE_SEQUENCE, ColorSpan, THEME, StyleRef, gen_colors
4242
from .trace import trace
4343

4444

Lib/_pyrepl/unix_console.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from collections.abc import Callable
3535
from dataclasses import dataclass
3636
from fcntl import ioctl
37-
from typing import TYPE_CHECKING, cast, overload
37+
from typing import TYPE_CHECKING, overload
3838

3939
from . import terminfo
4040
from .console import Console, Event

Lib/idlelib/idle_test/template.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"Test , coverage %."
22

3-
from idlelib import zzdummy
43
import unittest
54
from test.support import requires
65
from tkinter import Tk

Lib/idlelib/idle_test/test_help.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import unittest
55
from test.support import requires
66
requires('gui')
7-
from os.path import abspath, dirname, join
87
from tkinter import Tk
98

109

0 commit comments

Comments
 (0)