diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-12 22:57:59 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-12 22:57:59 (GMT) |
commit | 5c4bfc4af070c5c62f76cf3c2d23a19e7c794c4e (patch) | |
tree | bf62941930ba384c45a44d598e24566caa24e070 /Doc/reference/datamodel.rst | |
parent | 11b1f3dac14f72d7406c96fd7b749ebd8cc16bc9 (diff) | |
download | cpython-5c4bfc4af070c5c62f76cf3c2d23a19e7c794c4e.zip cpython-5c4bfc4af070c5c62f76cf3c2d23a19e7c794c4e.tar.gz cpython-5c4bfc4af070c5c62f76cf3c2d23a19e7c794c4e.tar.bz2 |
prefer clearing global objects to obscure module.__dict__ bugs #10068
Diffstat (limited to 'Doc/reference/datamodel.rst')
-rw-r--r-- | Doc/reference/datamodel.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 9d084cf..d3b2c15 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -654,6 +654,13 @@ Modules Special read-only attribute: :attr:`__dict__` is the module's namespace as a dictionary object. + .. impl-detail:: + + Because of the way CPython clears module dictionaries, the module + dictionary will be cleared when the module falls out of scope even if the + dictionary still has live references. To avoid this, copy the dictionary + or keep the module around while using its dictionary directly. + .. index:: single: __name__ (module attribute) single: __doc__ (module attribute) |