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 brett.cannon
Recipients brett.cannon
Date 2013-03-05.19:33:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362511985.74.0.511214026015.issue17358@psf.upfronthosting.co.za>
In-reply-to
Content
As of right now, if you use imp.load_module(), it will store any 'file' argument you give it in a hacked loader. That's a problem when you call imp.reload() on such a module, though, as subsequent calls to __loader__.load_module() will attempt to use the cached file object which was closed on the initial load. What the code should do is use the hacked loader to load the module, but then set an unhacked loader to __loader__ for reloads to work properly. Traceback below: ====================================================================== ERROR: test_source (test.test_imp.ReloadTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/build/work/cf49a3092a96daebb23bf3c6e0d86ac9/google3/tmp/lib/python3.3/test/test_imp.py", line 248, in test_source imp.reload(os) File "/build/work/cf49a3092a96daebb23bf3c6e0d86ac9/google3/tmp/lib/python3.3/imp.py", line 252, in reload return module.__loader__.load_module(name) File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper File "<frozen importlib._bootstrap>", line 1023, in load_module File "<frozen importlib._bootstrap>", line 1004, in load_module File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper File "<frozen importlib._bootstrap>", line 854, in _load_module File "<frozen importlib._bootstrap>", line 978, in get_code File "/build/work/cf49a3092a96daebb23bf3c6e0d86ac9/google3/tmp/lib/python3.3/imp.py", line 88, in get_data with self.file: ValueError: I/O operation on closed file.
History
Date User Action Args
2013-03-05 19:33:05brett.cannonsetrecipients: + brett.cannon
2013-03-05 19:33:05brett.cannonsetmessageid: <1362511985.74.0.511214026015.issue17358@psf.upfronthosting.co.za>
2013-03-05 19:33:05brett.cannonlinkissue17358 messages
2013-03-05 19:33:05brett.cannoncreate