New submission from Antoine Pitrou:

modules_by_index is a near-eternal store for extension modules. It is only 
collected at the end of interpreter shutdown, which is much too late for 
regular garbage collection. This patch proposes instead to store weak 
references in modules_by_index, so that extension modules can be collected in a 
normal way when they are removed from sys.modules.

The only gotcha is that PyState_FindModule returns a borrowed reference. With 
this change, it becomes really important to incref the returned reference as 
soon as possible.

----------
components: Interpreter Core
files: wr_module_state.patch
keywords: patch
messages: 194571
nosy: brett.cannon, eric.snow, loewis, ncoghlan, pitrou, sbt
priority: normal
severity: normal
stage: patch review
status: open
title: Store weak references in modules_by_index
type: resource usage
versions: Python 3.4
Added file: http://bugs.python.org/file31180/wr_module_state.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18674>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to