mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
[3.13] gh-122695: Fix double-free when using gc.get_referents
with a freed _asyncio.FutureIter
(#122837)
* Backport #122834 for 3.13
This commit is contained in:
parent
60c44ed975
commit
e8fb088dba
3 changed files with 10 additions and 11 deletions
|
@ -675,6 +675,14 @@ class CFutureTests(BaseFutureTests, test_utils.TestCase):
|
|||
with self.assertRaises(AttributeError):
|
||||
del fut._log_traceback
|
||||
|
||||
def test_future_iter_get_referents_segfault(self):
|
||||
# See https://github.com/python/cpython/issues/122695
|
||||
import _asyncio
|
||||
it = iter(self._new_future(loop=self.loop))
|
||||
del it
|
||||
evil = gc.get_referents(_asyncio)
|
||||
gc.collect()
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(futures, '_CFuture'),
|
||||
'requires the C _asyncio module')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue