Issue 33867: Module dicts are wiped on module garbage collection (original) (raw)

Issue33867

Created on 2018-06-15 03:34 by natedogith1, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg319581 - (view) Author: (natedogith1) Date: 2018-06-15 03:34
When a module is garbage collected, it fills it's __dict__ with None. and seem to suggest that this was fixed, along with github pull request 7140 (commit 196b0925ca55bf22ffbb97733cff3e63d4fb6e18). However, this still seems to be an issue in 2.7.14 and 3.6.2. >>> import sys >>> a = type(sys)('a') >>> b = a.__dict__ >>> b['__name__'] is None False >>> del a >>> b['__name__'] is None True
msg319648 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2018-06-15 19:02
I cannot reproduce this in 3.6.5: >>>import sys >>>import gc >>>a = type(sys)('a') >>>b = a.__dict__ >>>print(b['__name__'] is None) False >>>del a >>>gc.collect() >>>print(b['__name__'] is None) False On the other hand, this still happens in 2.7.15: Python 2.7.15 (default, May 1 2018, 20:16:04) [GCC 7.3.1 20180406] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>import sys >>>import gc >>>a = type(sys)('a') >>>b = a.__dict__ >>>print(b['__name__'] is None) False >>>del a >>>gc.collect() >>>print(b['__name__'] is None) True
msg377485 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-09-25 10:44
I also can't reproduce it on a later version. If this is a 2.7/3.6 only problem, should the issue be closed?
History
Date User Action Args
2022-04-11 14:59:01 admin set github: 78048
2020-09-25 18:14:48 serhiy.storchaka set status: open -> closedresolution: out of datestage: resolved
2020-09-25 10:44:14 iritkatriel set nosy: + iritkatrielmessages: +
2018-06-15 19:02:13 pablogsal set nosy: + pablogsalmessages: +
2018-06-15 08:59:07 xiang.zhang set nosy: + pitrou
2018-06-15 03:34:11 natedogith1 create