Issue 11640: Shelve references globals in its del method (original) (raw)

Issue11640

Created on 2011-03-22 22:15 by Peter.Davies, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
shelve_del_fix.diff Peter.Davies,2011-03-22 22:15 Fix which stores the globals in the shelf
Messages (4)
msg131793 - (view) Author: Peter Davies (Peter.Davies) Date: 2011-03-22 22:15
Shelf.__setitem__ (which is called from __del__ when writeback is enabled) references globals. This was causing exceptions on interpreter shutdown (due to another exception) for me. I have attached a patch which stores the relevant globals in the Shelf object.
msg141436 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-07-30 10:44
The patch looks good to me. Is there any way this could be tested in the test suite? How to simulate interpreter shutdown?
msg141524 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2011-08-01 16:20
Could you add a comment above the lines defining self._BytesIO, describing why they're being set? Someone else might see them as unnecessary and rip them out if there's no explanation. Can a test launch Python in a subprocess, set up the appropriate data structure, let the subprocess Python shutdown, then check the subprocess's stderr for the error? It's a little convoluted, but perhaps it could be built into a general utility function that could be used to test __del__ methods in other modules, too. Not sure that it's worth the effort though.
msg275925 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-09-12 02:43
Since PEP 442 has been implemented in 3.4 and e826940911c8 made Shelve.close() more robust, I think this is no longer an issue.
History
Date User Action Args
2022-04-11 14:57:15 admin set github: 55849
2016-09-12 02:43:11 berker.peksag set status: open -> closednosy: + berker.peksagmessages: + resolution: out of datestage: patch review -> resolved
2013-02-06 18:17:53 serhiy.storchaka set versions: + Python 3.4
2011-08-01 16:20:31 stutzbach set messages: +
2011-07-30 10:44:37 petri.lehtinen set nosy: + petri.lehtinenmessages: + keywords: + needs review, - patchstage: patch review
2011-03-25 17:30:11 daniel.urban set nosy: + daniel.urban
2011-03-22 22:41:36 stutzbach set nosy: + stutzbachversions: + Python 3.3
2011-03-22 22:15:42 Peter.Davies create