mirror of
https://github.com/python/cpython.git
synced 2025-08-11 20:40:27 +00:00
[3.12] gh-115874: Don't use module state in teedataobject tp_dealloc (GH-116204) (#116955)
(cherry picked from commit e2fcaf19d3
)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
This commit is contained in:
parent
25243b1461
commit
1c0c6c91af
2 changed files with 12 additions and 6 deletions
|
@ -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
|
||||
|
@ -1695,6 +1695,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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue