Skip to content

Commit 21fd115

Browse files
committed
Trim test comments and NEWS wording
1 parent 169fcfc commit 21fd115

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

Lib/test/test_free_threading/test_string_template_race.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
@threading_helper.requires_working_threading()
99
class TestTemplateCompileRace(unittest.TestCase):
1010
def test_concurrent_first_use(self):
11-
# Template compiles its pattern lazily on first use and caches it on the
12-
# class. Race that lazy compile from many threads and confirm none hits
13-
# a spurious ValueError from recompiling an already-compiled pattern.
14-
# Use a throwaway subclass each round so the shared string.Template is
15-
# never mutated; subclasses precompile in __init_subclass__, so restore
16-
# the sentinel descriptor (string._TemplatePattern) to re-arm the lazy
17-
# path before racing.
11+
# Racing the lazy pattern compile must not raise a spurious ValueError
12+
# from recompiling an already-compiled pattern. A throwaway subclass,
13+
# re-armed to the sentinel each round, keeps string.Template unmutated
14+
# (subclasses precompile eagerly in __init_subclass__).
1815
uncompiled = string._TemplatePattern
1916
errors = []
2017

Lib/test/test_string/test_string.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ def test_SafeTemplate(self):
302302
def test_precompiled_pattern(self):
303303
# A subclass may supply an already-compiled pattern; it must be reused,
304304
# not recompiled (re.compile() rejects flags on a compiled pattern).
305-
# This is the non-threaded form of the free-threading lazy-compile race
306-
# where a thread observes the pattern another thread just compiled.
307305
import re
308306
compiled = re.compile(
309307
r'\$(?:(?P<escaped>\$)|(?P<named>[a-z]+)|'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Fix a race in :class:`string.Template` where concurrent first use of a
2-
template on the free-threaded build could raise a spurious :exc:`ValueError`.
1+
Fix a race in :class:`string.Template` where concurrent first use on the
2+
free-threaded build could raise a spurious :exc:`ValueError`.

0 commit comments

Comments
 (0)