This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Drekin, docs@python, ncoghlan, sbt
Date 2013-07-01.00:25:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1372638349.5.0.394327629375.issue18331@psf.upfronthosting.co.za>
In-reply-to
Content
As Richard said, the __globals__ attributes of the functions are pointing at the real module dictionary, which may have been cleared when the temporary module was destroyed.

However, I just checked the docs and they don't actually mention the fact that run_path and run_module currently return a copy of the globals - they say they "return the resulting module globals dictionary."

Since I would prefer it if the functions actually worked as advertised, I suggest we document the namespace copying as a CPython implementation detail, rather than as a guaranteed feature. That way we can eliminate these copy operations once the module namespace purging has been eliminated.

Some related references:
   Don't purge module dicts before shutdown: issue 18214
   Don't purge module dicts at all: issue 812369
   More robust finalisation semantics: PEP 442
   
We should also tidy up the headings in the data model reference (
http://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy) so we can link directly to the section that mentions the CPython module clearing implementation detail this behaviour is designed to work around.
History
Date User Action Args
2013-07-01 00:25:49ncoghlansetrecipients: + ncoghlan, docs@python, sbt, Drekin
2013-07-01 00:25:49ncoghlansetmessageid: <1372638349.5.0.394327629375.issue18331@psf.upfronthosting.co.za>
2013-07-01 00:25:49ncoghlanlinkissue18331 messages
2013-07-01 00:25:48ncoghlancreate