Skip to content

Commit 3b0ee8e

Browse files
Pull in main
2 parents 2757df4 + d9cfe7e commit 3b0ee8e

33 files changed

Lines changed: 467 additions & 291 deletions

.github/workflows/jit.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ on:
55
- '**jit**'
66
- 'Python/bytecodes.c'
77
- 'Python/optimizer*.c'
8-
- 'Python/optimizer_bytecodes.c'
98
push:
109
paths:
1110
- '**jit**'
1211
- 'Python/bytecodes.c'
1312
- 'Python/optimizer*.c'
14-
- 'Python/optimizer_bytecodes.c'
1513
workflow_dispatch:
1614

1715
concurrency:
@@ -22,7 +20,7 @@ jobs:
2220
jit:
2321
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
2422
runs-on: ${{ matrix.runner }}
25-
timeout-minutes: 60
23+
timeout-minutes: 75
2624
strategy:
2725
fail-fast: false
2826
matrix:
@@ -95,7 +93,7 @@ jobs:
9593
run: |
9694
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
9795
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
98-
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
96+
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3
9997
10098
# No PGO or tests (yet):
10199
- name: Emulated Windows
@@ -111,7 +109,7 @@ jobs:
111109
SDKROOT="$(xcrun --show-sdk-path)" \
112110
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
113111
make all --jobs 4
114-
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
112+
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3
115113
116114
- name: Native Linux
117115
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
@@ -120,7 +118,7 @@ jobs:
120118
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
121119
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
122120
make all --jobs 4
123-
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
121+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3
124122
125123
- name: Emulated Linux
126124
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
@@ -140,4 +138,4 @@ jobs:
140138
HOSTRUNNER=qemu-${{ matrix.architecture }} \
141139
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
142140
make all --jobs 4
143-
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
141+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ iterations of the loop.
12241224
except that ``namei`` is shifted left by 2 bits instead of 1.
12251225

12261226
The low bit of ``namei`` signals to attempt a method load, as with
1227-
:opcode:`LOAD_ATTR`, which results in pushing ``None`` and the loaded method.
1227+
:opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method.
12281228
When it is unset a single value is pushed to the stack.
12291229

12301230
The second-low bit of ``namei``, if set, means that this was a two-argument

Doc/library/doctest.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,8 @@ from text files and modules with doctests:
10211021
and runs the interactive examples in each file. If an example in any file
10221022
fails, then the synthesized unit test fails, and a :exc:`failureException`
10231023
exception is raised showing the name of the file containing the test and a
1024-
(sometimes approximate) line number.
1024+
(sometimes approximate) line number. If all the examples in a file are
1025+
skipped, then the synthesized unit test is also marked as skipped.
10251026

10261027
Pass one or more paths (as strings) to text files to be examined.
10271028

@@ -1087,7 +1088,8 @@ from text files and modules with doctests:
10871088
and runs each doctest in the module. If any of the doctests fail, then the
10881089
synthesized unit test fails, and a :exc:`failureException` exception is raised
10891090
showing the name of the file containing the test and a (sometimes approximate)
1090-
line number.
1091+
line number. If all the examples in a docstring are skipped, then the
1092+
synthesized unit test is also marked as skipped.
10911093

10921094
Optional argument *module* provides the module to be tested. It can be a module
10931095
object or a (possibly dotted) module name. If not specified, the module calling

Include/internal/pycore_critical_section.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,13 @@ extern "C" {
8787
#define _Py_CRITICAL_SECTION_MASK 0x3
8888

8989
#ifdef Py_GIL_DISABLED
90-
# define Py_BEGIN_CRITICAL_SECTION(op) \
90+
# define Py_BEGIN_CRITICAL_SECTION_MUT(mutex) \
9191
{ \
9292
_PyCriticalSection _cs; \
93-
_PyCriticalSection_Begin(&_cs, &_PyObject_CAST(op)->ob_mutex)
93+
_PyCriticalSection_Begin(&_cs, mutex)
94+
95+
# define Py_BEGIN_CRITICAL_SECTION(op) \
96+
Py_BEGIN_CRITICAL_SECTION_MUT(&_PyObject_CAST(op)->ob_mutex)
9497

9598
# define Py_END_CRITICAL_SECTION() \
9699
_PyCriticalSection_End(&_cs); \
@@ -138,6 +141,7 @@ extern "C" {
138141

139142
#else /* !Py_GIL_DISABLED */
140143
// The critical section APIs are no-ops with the GIL.
144+
# define Py_BEGIN_CRITICAL_SECTION_MUT(mut)
141145
# define Py_BEGIN_CRITICAL_SECTION(op)
142146
# define Py_END_CRITICAL_SECTION()
143147
# define Py_XBEGIN_CRITICAL_SECTION(op)

Include/internal/pycore_warnings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct _warnings_runtime_state {
1414
PyObject *filters; /* List */
1515
PyObject *once_registry; /* Dict */
1616
PyObject *default_action; /* String */
17+
struct _PyMutex mutex;
1718
long filters_version;
1819
};
1920

Lib/doctest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,12 +2281,13 @@ def runTest(self):
22812281

22822282
try:
22832283
runner.DIVIDER = "-"*70
2284-
failures, tries = runner.run(
2285-
test, out=new.write, clear_globs=False)
2284+
results = runner.run(test, out=new.write, clear_globs=False)
2285+
if results.skipped == results.attempted:
2286+
raise unittest.SkipTest("all examples were skipped")
22862287
finally:
22872288
sys.stdout = old
22882289

2289-
if failures:
2290+
if results.failed:
22902291
raise self.failureException(self.format_failure(new.getvalue()))
22912292

22922293
def format_failure(self, err):

Lib/ntpath.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -831,23 +831,22 @@ def relpath(path, start=None):
831831
raise
832832

833833

834-
# Return the longest common sub-path of the sequence of paths given as input.
834+
# Return the longest common sub-path of the iterable of paths given as input.
835835
# The function is case-insensitive and 'separator-insensitive', i.e. if the
836836
# only difference between two paths is the use of '\' versus '/' as separator,
837837
# they are deemed to be equal.
838838
#
839839
# However, the returned path will have the standard '\' separator (even if the
840840
# given paths had the alternative '/' separator) and will have the case of the
841-
# first path given in the sequence. Additionally, any trailing separator is
841+
# first path given in the iterable. Additionally, any trailing separator is
842842
# stripped from the returned path.
843843

844844
def commonpath(paths):
845-
"""Given a sequence of path names, returns the longest common sub-path."""
846-
845+
"""Given an iterable of path names, returns the longest common sub-path."""
846+
paths = tuple(map(os.fspath, paths))
847847
if not paths:
848-
raise ValueError('commonpath() arg is an empty sequence')
848+
raise ValueError('commonpath() arg is an empty iterable')
849849

850-
paths = tuple(map(os.fspath, paths))
851850
if isinstance(paths[0], bytes):
852851
sep = b'\\'
853852
altsep = b'/'

Lib/test/test_clinic.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ def _expect_failure(tc, parser, code, errmsg, *, filename=None, lineno=None,
5252
return cm.exception
5353

5454

55+
def restore_dict(converters, old_converters):
56+
converters.clear()
57+
converters.update(old_converters)
58+
59+
60+
def save_restore_converters(testcase):
61+
testcase.addCleanup(restore_dict, clinic.converters,
62+
clinic.converters.copy())
63+
testcase.addCleanup(restore_dict, clinic.legacy_converters,
64+
clinic.legacy_converters.copy())
65+
testcase.addCleanup(restore_dict, clinic.return_converters,
66+
clinic.return_converters.copy())
67+
68+
5569
class ClinicWholeFileTest(TestCase):
5670
maxDiff = None
5771

@@ -60,6 +74,7 @@ def expect_failure(self, raw, errmsg, *, filename=None, lineno=None):
6074
filename=filename, lineno=lineno)
6175

6276
def setUp(self):
77+
save_restore_converters(self)
6378
self.clinic = _make_clinic(filename="test.c")
6479

6580
def test_eol(self):
@@ -2431,6 +2446,9 @@ def test_state_func_docstring_only_one_param_template(self):
24312446
class ClinicExternalTest(TestCase):
24322447
maxDiff = None
24332448

2449+
def setUp(self):
2450+
save_restore_converters(self)
2451+
24342452
def run_clinic(self, *args):
24352453
with (
24362454
support.captured_stdout() as out,

Lib/test/test_decimal.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
check_disallow_instantiation)
3939
from test.support import (TestFailed,
4040
run_with_locale, cpython_only,
41-
darwin_malloc_err_warning, is_emscripten)
41+
darwin_malloc_err_warning, is_emscripten,
42+
skip_on_s390x)
4243
from test.support.import_helper import import_fresh_module
4344
from test.support import threading_helper
4445
from test.support import warnings_helper
@@ -5650,6 +5651,9 @@ def __abs__(self):
56505651
@unittest.skipIf(check_sanitizer(address=True, memory=True),
56515652
"ASAN/MSAN sanitizer defaults to crashing "
56525653
"instead of returning NULL for malloc failure.")
5654+
# gh-114331: The test allocates 784 271 641 GiB and mimalloc does not fail
5655+
# to allocate it when using mimalloc on s390x.
5656+
@skip_on_s390x
56535657
def test_maxcontext_exact_arith(self):
56545658

56555659
# Make sure that exact operations do not raise MemoryError due
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"""This is a sample module used for testing doctest.
2+
3+
This module includes various scenarios involving skips.
4+
"""
5+
6+
def no_skip_pass():
7+
"""
8+
>>> 2 + 2
9+
4
10+
"""
11+
12+
def no_skip_fail():
13+
"""
14+
>>> 2 + 2
15+
5
16+
"""
17+
18+
def single_skip():
19+
"""
20+
>>> 2 + 2 # doctest: +SKIP
21+
4
22+
"""
23+
24+
def double_skip():
25+
"""
26+
>>> 2 + 2 # doctest: +SKIP
27+
4
28+
>>> 3 + 3 # doctest: +SKIP
29+
6
30+
"""
31+
32+
def partial_skip_pass():
33+
"""
34+
>>> 2 + 2 # doctest: +SKIP
35+
4
36+
>>> 3 + 3
37+
6
38+
"""
39+
40+
def partial_skip_fail():
41+
"""
42+
>>> 2 + 2 # doctest: +SKIP
43+
4
44+
>>> 2 + 2
45+
5
46+
"""
47+
48+
def no_examples():
49+
"""A docstring with no examples should not be counted as run or skipped."""

0 commit comments

Comments
 (0)