[issue18674] Store weak references in modules_by_index

2013-09-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, rejecting my own patch because of compatibility issues. -- resolution: -> wont fix stage: patch review -> committed/rejected status: open -> closed ___ Python tracker

[issue18674] Store weak references in modules_by_index

2013-09-29 Thread Brett Cannon
Brett Cannon added the comment: Fine by me. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue18674] Store weak references in modules_by_index

2013-09-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: I think the "new new module initialization scheme", if it takes steam, is much more promising to solve the underlying issue. I'm inclined to close this entry as "won't fix", what do you think? -- ___ Python tracker

[issue18674] Store weak references in modules_by_index

2013-08-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: (and of course, with module states not being PyObjects, we have the same lifetimes issues as with Py_buffers not being PyObjects) -- ___ Python tracker ___

[issue18674] Store weak references in modules_by_index

2013-08-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It seems to me that the more appropriate change here would be to > redefine PyState_FindModule as return a *new* ref rather than a > borrowed ref and have it do the Py_INCREF before returning. > > Code using it would then need to add an appropriate Py_DECREF.

[issue18674] Store weak references in modules_by_index

2013-08-06 Thread Nick Coghlan
Nick Coghlan added the comment: It seems to me that the more appropriate change here would be to redefine PyState_FindModule as return a *new* ref rather than a borrowed ref and have it do the Py_INCREF before returning. Code using it would then need to add an appropriate Py_DECREF. A referenc

[issue18674] Store weak references in modules_by_index

2013-08-06 Thread Brett Cannon
Brett Cannon added the comment: Sounds like it needs to be changed with a notice in What's New. -- ___ Python tracker ___ ___ Python-b

[issue18674] Store weak references in modules_by_index

2013-08-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Theoretically, people *should* already incref the result from PyState_FindModule. On the other hand, the object currently wouldn't be lost unless something else calls PyState_RemoveModule(), which is hardly every used AFAICT. The only saving grace is that PyS

[issue18674] Store weak references in modules_by_index

2013-08-06 Thread Brett Cannon
Brett Cannon added the comment: Won't that change to PyState_FindModule() break code? And is it part of the stable ABI? -- ___ Python tracker ___ ___

[issue18674] Store weak references in modules_by_index

2013-08-06 Thread Antoine Pitrou
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