Skip to content

Commit 0256904

Browse files
committed
Fix the signature of filter_clear to solve the problem in the RecursionError test
1 parent 413beaa commit 0256904

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Lib/test/test_builtin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ def test_filter_dealloc(self):
11321132
del i
11331133
gc.collect()
11341134

1135-
@support.requires_resource('cpu')
1135+
11361136
def test_filter_deep_nesting_recursion_error(self):
11371137
# gh-137894: Test that deeply nested filter() iterator chains
11381138
# raise RecursionError instead of causing segmentation fault.
@@ -1142,9 +1142,7 @@ def test_filter_deep_nesting_recursion_error(self):
11421142
for _ in range(100000):
11431143
i = filter(bool, i)
11441144

1145-
# Should raise RecursionError, not segmentation fault
1146-
with self.assertRaises(RecursionError):
1147-
list(i)
1145+
self.assertRaises(RecursionError, list, i)
11481146

11491147
def test_getattr(self):
11501148
self.assertTrue(getattr(sys, 'stdout') is sys.stdout)

Python/bltinmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ PyTypeObject PyFilter_Type = {
670670
Py_TPFLAGS_BASETYPE, /* tp_flags */
671671
filter_doc, /* tp_doc */
672672
filter_traverse, /* tp_traverse */
673-
(inquiry)filter_clear, /* tp_clear */
673+
filter_clear, /* tp_clear */
674674
0, /* tp_richcompare */
675675
0, /* tp_weaklistoffset */
676676
PyObject_SelfIter, /* tp_iter */

0 commit comments

Comments
 (0)