Skip to content

Commit e8035ec

Browse files
Merge branch '3.14' into feat/gc-gen-3.14
2 parents 8153914 + e9aacf9 commit e8035ec

File tree

7 files changed

+25
-17
lines changed

7 files changed

+25
-17
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Lib/test/xmltestdata/* noeol
3434
Lib/venv/scripts/common/activate text eol=lf
3535
Lib/venv/scripts/posix/* text eol=lf
3636

37+
# Prevent GitHub's web conflict editor from converting LF to CRLF
38+
*.rst text eol=lf
39+
3740
# CRLF files
3841
[attr]dos text eol=crlf
3942

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
- "Tools/build/compute-changes.py"
1919
- "Tools/build/deepfreeze.py"
2020
- "Tools/build/generate-build-details.py"
21+
- "Tools/build/generate_levenshtein_examples.py"
2122
- "Tools/build/generate_sbom.py"
2223
- "Tools/build/generate_stdlib_module_names.py"
2324
- "Tools/build/mypy.ini"

.github/workflows/reusable-san.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,15 @@ jobs:
4040
# Install clang
4141
wget https://apt.llvm.org/llvm.sh
4242
chmod +x llvm.sh
43+
sudo ./llvm.sh 20
44+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 100
45+
sudo update-alternatives --set clang /usr/bin/clang-20
46+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 100
47+
sudo update-alternatives --set clang++ /usr/bin/clang++-20
4348
4449
if [ "${SANITIZER}" = "TSan" ]; then
45-
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
46-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
47-
sudo update-alternatives --set clang /usr/bin/clang-17
48-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
49-
sudo update-alternatives --set clang++ /usr/bin/clang++-17
5050
# Reduce ASLR to avoid TSan crashing
5151
sudo sysctl -w vm.mmap_rnd_bits=28
52-
else
53-
sudo ./llvm.sh 20
5452
fi
5553
5654
- name: Sanitizer option setup

Lib/test/test_marshal.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ def f():
357357
code = f.__code__
358358
a = []
359359
code = code.replace(co_consts=code.co_consts + (a,))
360+
# This test creates a reference loop which leads to reference leaks,
361+
# so we need to break the loop manually. See gh-148722.
362+
self.addCleanup(a.clear)
360363
a.append(code)
361364
for v in range(marshal.version + 1):
362365
self.assertRaises(ValueError, marshal.dumps, code, v)
@@ -404,10 +407,12 @@ def test_loads_abnormal_reference_loops(self):
404407
self.assertIs(a[0][None], a)
405408

406409
# Direct self-reference which cannot be created in Python.
407-
data = b'\xa8\x01\x00\x00\x00r\x00\x00\x00\x00' # (<R>,)
408-
a = marshal.loads(data)
409-
self.assertIsInstance(a, tuple)
410-
self.assertIs(a[0], a)
410+
# This creates a reference loop which cannot be collected.
411+
if False:
412+
data = b'\xa8\x01\x00\x00\x00r\x00\x00\x00\x00' # (<R>,)
413+
a = marshal.loads(data)
414+
self.assertIsInstance(a, tuple)
415+
self.assertIs(a[0], a)
411416

412417
# Direct self-references which cannot be created in Python
413418
# because of unhashability.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Fix crash in :mod:`csv` reader when iterating with a re-entrant iterator
2-
that calls :func:`next` on the same reader from within ``__next__``.
1+
Fix crash in :mod:`csv` reader when iterating with a re-entrant iterator
2+
that calls :func:`next` on the same reader from within ``__next__``.

Tools/build/generate_levenshtein_examples.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
_CASE_COST = 1
1414

1515

16-
def _substitution_cost(ch_a, ch_b):
16+
def _substitution_cost(ch_a: str, ch_b: str) -> int:
1717
if ch_a == ch_b:
1818
return 0
1919
if ch_a.lower() == ch_b.lower():
@@ -22,7 +22,7 @@ def _substitution_cost(ch_a, ch_b):
2222

2323

2424
@lru_cache(None)
25-
def levenshtein(a, b):
25+
def levenshtein(a: str, b: str) -> int:
2626
if not a or not b:
2727
return (len(a) + len(b)) * _MOVE_COST
2828
option1 = levenshtein(a[:-1], b[:-1]) + _substitution_cost(a[-1], b[-1])
@@ -31,7 +31,7 @@ def levenshtein(a, b):
3131
return min(option1, option2, option3)
3232

3333

34-
def main():
34+
def main() -> None:
3535
parser = argparse.ArgumentParser(description=__doc__)
3636
parser.add_argument('output_path', metavar='FILE', type=str)
3737
parser.add_argument('--overwrite', dest='overwrite', action='store_const',
@@ -48,7 +48,7 @@ def main():
4848
)
4949
return
5050

51-
examples = set()
51+
examples: set[tuple[str, str, int]] = set()
5252
# Create a lot of non-empty examples, which should end up with a Gauss-like
5353
# distribution for even costs (moves) and odd costs (case substitutions).
5454
while len(examples) < 9990:

Tools/build/mypy.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ files =
88
Tools/build/compute-changes.py,
99
Tools/build/deepfreeze.py,
1010
Tools/build/generate-build-details.py,
11+
Tools/build/generate_levenshtein_examples.py,
1112
Tools/build/generate_sbom.py,
1213
Tools/build/generate_stdlib_module_names.py,
1314
Tools/build/verify_ensurepip_wheels.py,

0 commit comments

Comments
 (0)