Skip to content

Commit 9d32714

Browse files
authored
bpo-45745: Remove regrtest --findleaks options (GH-29514)
Remove the --findleaks command line option of regrtest: use the --fail-env-changed option instead. Since Python 3.7, it was a deprecated alias to the --fail-env-changed option.
1 parent 8f1b71d commit 9d32714

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

Lib/test/libregrtest/cmdline.py

-7
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ def __init__(self, **kwargs) -> None:
149149
self.single = False
150150
self.randomize = False
151151
self.fromfile = None
152-
self.findleaks = 1
153152
self.fail_env_changed = False
154153
self.use_resources = None
155154
self.trace = False
@@ -266,9 +265,6 @@ def _create_parser():
266265
'(instead of the Python stdlib test suite)')
267266

268267
group = parser.add_argument_group('Special runs')
269-
group.add_argument('-l', '--findleaks', action='store_const', const=2,
270-
default=1,
271-
help='deprecated alias to --fail-env-changed')
272268
group.add_argument('-L', '--runleaks', action='store_true',
273269
help='run the leaks(1) command just before exit.' +
274270
more_details)
@@ -370,9 +366,6 @@ def _parse_args(args, **kwargs):
370366
parser.error("unrecognized arguments: %s" % arg)
371367
sys.exit(1)
372368

373-
if ns.findleaks > 1:
374-
# --findleaks implies --fail-env-changed
375-
ns.fail_env_changed = True
376369
if ns.single and ns.fromfile:
377370
parser.error("-s and -f don't go together!")
378371
if ns.use_mp is not None and ns.trace:

Lib/test/libregrtest/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Regrtest:
4646
files beginning with test_ will be used.
4747
4848
The other default arguments (verbose, quiet, exclude,
49-
single, randomize, findleaks, use_resources, trace, coverdir,
49+
single, randomize, use_resources, trace, coverdir,
5050
print_slow, and random_seed) allow programmers calling main()
5151
directly to set the values that would normally be set by flags
5252
on the command line.

Lib/test/libregrtest/runtest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __str__(self) -> str:
138138
NOTTESTS = set()
139139

140140

141-
# used by --findleaks, store for gc.garbage
141+
# Storage of uncollectable objects
142142
FOUND_GARBAGE = []
143143

144144

@@ -279,7 +279,7 @@ def save_env(ns: Namespace, test_name: str):
279279

280280
def _runtest_inner2(ns: Namespace, test_name: str) -> bool:
281281
# Load the test function, run the test function, handle huntrleaks
282-
# and findleaks to detect leaks
282+
# to detect leaks.
283283

284284
abstest = get_abs_module(ns, test_name)
285285

Lib/test/test_regrtest.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ def test_other_bug(self):
11781178
no_test_ran=[testname])
11791179

11801180
@support.cpython_only
1181-
def test_findleaks(self):
1181+
def test_uncollectable(self):
11821182
code = textwrap.dedent(r"""
11831183
import _testcapi
11841184
import gc
@@ -1203,12 +1203,6 @@ def test_garbage(self):
12031203
env_changed=[testname],
12041204
fail_env_changed=True)
12051205

1206-
# --findleaks is now basically an alias to --fail-env-changed
1207-
output = self.run_tests("--findleaks", testname, exitcode=3)
1208-
self.check_executed_tests(output, [testname],
1209-
env_changed=[testname],
1210-
fail_env_changed=True)
1211-
12121206
def test_multiprocessing_timeout(self):
12131207
code = textwrap.dedent(r"""
12141208
import time
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Remove the ``--findleaks`` command line option of regrtest: use the
2+
``--fail-env-changed`` option instead. Since Python 3.7, it was a deprecated
3+
alias to the ``--fail-env-changed`` option.

0 commit comments

Comments
 (0)