[Python-Dev] Block module import during Python finalization? (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Mon Oct 28 21🔞44 CET 2013
- Previous message: [Python-Dev] Block module import during Python finalization?
- Next message: [Python-Dev] Block module import during Python finalization?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 28 Oct 2013 16:13:36 -0400 Benjamin Peterson <benjamin at python.org> wrote:
2013/10/28 Victor Stinner <victor.stinner at gmail.com>: > Hi, > > While working on a fix, I got an assertion error during Python > finalization because Python tried to import the "io" module whereas > the module was just unloaded. Python tried to import the io module to > display a warning and display the Python line where the warning was > emitted. See the following issue for detail: > http://bugs.python.org/issue19421 > > I propose to block importing new modules (or import again unloaded > modules) during Python finalization to avoid such tricky bugs. > > What do you think?
Though the practice of importing during finalization seems dubious, baning it may be a compatibility problem.
It may just be because some finalizer is calling an API that uses lazy imports. Honestly, I don't event think this issue is a bug. Importing modules at shutdown isn't worse than creating functions or classes at shutdown.
Regards
Antoine.
- Previous message: [Python-Dev] Block module import during Python finalization?
- Next message: [Python-Dev] Block module import during Python finalization?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]