[Python-Dev] is sys.modules not meant to be replaced? (original) (raw)
Eric Snow ericsnowcurrently at gmail.com
Sun Jul 24 06:53:38 CEST 2011
- Previous message: [Python-Dev] Convention on functions that shadow existing stdlib functions
- Next message: [Python-Dev] is sys.modules not meant to be replaced?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The documentation[1] doesn't say, but the implementation of the imp module makes me wonder if sys.modules was not meant to be replaceable. No doubt this has to do with its tie to the interpreter's modules dict. I ran into this doing "sys.modules = sys.modules.copy()" to protect the actual sys.modules dict during some import related test cases. If the modules I imported were extension modules it broke.
So, is sys.modules not meant to be open to re-binding?
-eric
p.s. I tried opening a tracker ticket on this, but it wouldn't go through. I'll try again later.
[1] http://docs.python.org/library/sys.html#sys.modules
- Previous message: [Python-Dev] Convention on functions that shadow existing stdlib functions
- Next message: [Python-Dev] is sys.modules not meant to be replaced?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]