You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
_pickle should implement the module finalisation protocol #55558
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/avassalotti'closed_at=<Date2013-12-01.21:52:09.998>created_at=<Date2011-02-28.01:29:10.979>labels= ['extension-modules', 'type-feature']
title='_pickle should implement the module finalisation protocol'updated_at=<Date2013-12-01.21:52:09.996>user='https://github.com/ncoghlan'
As discussed in bpo-11321, _pickle allocates a number of module level objects, but doesn't use the appropriate PEP-3121 mechanisms to manage their lifecycle.
It should be updated to follow the relevant development guidelines in the documentation.
Unfortunately "proper" module finalization is an invitation to more segfaults because modules can be finalized before objects in them are, resulting in segfaults when its attempted to access modules.
In that case, the request should probably read "_pickle should implement the module finalisation protocol, and module finalisation should be designed so that doing so isn't a recipe for segfaults".
It strikes me as being very similar to the existing problems we have with modules setting everything to None during shutdown, so my estimation of the difficulty of this request has risen accordingly :P
It's a chicken and egg problem because proper module finalization techniques like bpo-812369 are bogged down by static globals in extension modules, and proper state storage in modules is prevented by proper module finalization.
We might be able to tapdance our way around the issue by falling back to the old mechanism when dealing with extension modules without traverse/clear/dealloc methods.
Activity
ncoghlan commentedon Feb 28, 2011
As discussed in bpo-11321, _pickle allocates a number of module level objects, but doesn't use the appropriate PEP-3121 mechanisms to manage their lifecycle.
It should be updated to follow the relevant development guidelines in the documentation.
benjaminp commentedon Feb 28, 2011
Unfortunately "proper" module finalization is an invitation to more segfaults because modules can be finalized before objects in them are, resulting in segfaults when its attempted to access modules.
ncoghlan commentedon Feb 28, 2011
In that case, the request should probably read "_pickle should implement the module finalisation protocol, and module finalisation should be designed so that doing so isn't a recipe for segfaults".
It strikes me as being very similar to the existing problems we have with modules setting everything to None during shutdown, so my estimation of the difficulty of this request has risen accordingly :P
benjaminp commentedon Feb 28, 2011
It's a chicken and egg problem because proper module finalization techniques like bpo-812369 are bogged down by static globals in extension modules, and proper state storage in modules is prevented by proper module finalization.
ncoghlan commentedon Mar 1, 2011
We might be able to tapdance our way around the issue by falling back to the old mechanism when dealing with extension modules without traverse/clear/dealloc methods.
pitrou commentedon Mar 1, 2011
Not sure why bpo-812369 is bogged down. The patch simply needs updating for 3.x.
benjaminp commentedon Mar 1, 2011
http://mail.python.org/pipermail/python-dev/2009-October/093057.html
2011/3/1 Antoine Pitrou <report@bugs.python.org>:
avassalotti commentedon Dec 1, 2013
I have implemented PEP-3121 module finalization for _pickle in 64c6d52793be.