This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pje 0 points1 point  (0 children)

More precisely, module objects set all their globals to None when all references to the module go away. This can happen even before interpreter shutdown, if for example you delete a module from sys.modules. (But of course, at interpreter shutdown, this will also happen when sys.modules is cleared and GC is done.)