summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 9af0730..95e6791 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1,7 +1,7 @@
import doctest
import unittest
from test import support
-from test.support import threading_helper
+from test.support import threading_helper, script_helper
from itertools import *
import weakref
from decimal import Decimal
@@ -1699,6 +1699,14 @@ class TestBasicOps(unittest.TestCase):
self.pickletest(proto, a, compare=ans)
self.pickletest(proto, b, compare=ans)
+ def test_tee_dealloc_segfault(self):
+ # gh-115874: segfaults when accessing module state in tp_dealloc.
+ script = (
+ "import typing, copyreg, itertools; "
+ "copyreg.buggy_tee = itertools.tee(())"
+ )
+ script_helper.assert_python_ok("-c", script)
+
# Issue 13454: Crash when deleting backward iterator from tee()
def test_tee_del_backward(self):
forward, backward = tee(repeat(None, 20000000))