- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 33.3k
 
Open
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
If we put this code snippet to Lib/test/test_dict_user_leak.py
import unittest
class DictUser:
    def __init__(self, d: dict):
        self.d = d
    def __del__(self):
        self.d['a'] = DictUser(self.d)
class TestFinalizerLeak(unittest.TestCase):
    def test_dict_user(self):
        DictUser(dict())
if __name__ == '__main__':
    unittest.main()then we can see leaks with the following command:
./python -m test -R 3:3 -v test_dict_user_leak
CPython versions tested on:
CPython main branch, 3.14, 3.13
Operating systems tested on:
Linux
sergey-miryanov
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error