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 Arfrever, brett.cannon, eric.snow, ncoghlan, pje
Date 2013-10-31.11:53:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1383220419.12.0.755328915545.issue19413@psf.upfronthosting.co.za>
In-reply-to
Content
Failing test case showing that Python 3.3 can't reload a module that is converted to a package behind importlib's back (I like this better than the purely introspection based tests, since it shows a real, albeit obscure, regression due to this behavioural change):

$ ./broken_reload.py 
E
======================================================================
ERROR: test_module_to_package (__main__.TestBadReload)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./broken_reload.py", line 28, in test_module_to_package
    imp.reload(mod)
  File "/usr/lib64/python3.3/imp.py", line 271, in reload
    return module.__loader__.load_module(name)
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1024, in load_module
  File "<frozen importlib._bootstrap>", line 1005, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 855, in _load_module
  File "<frozen importlib._bootstrap>", line 950, in get_code
  File "<frozen importlib._bootstrap>", line 1043, in path_stats
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp_n48mm/to_be_reloaded.py'

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (errors=1)

Interactive session showing that import.c didn't have this problem, since it reran the whole search (foo is just a toy module I had lying around in my play directory):

$ python
Python 2.7.5 (default, Oct  8 2013, 12:19:40) 
[GCC 4.8.1 20130603 (Red Hat 4.8.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo
Hello
>>> foo.__file__
'foo.py'
>>> import os
>>> os.mkdir("foo")
>>> os.rename('foo.py', 'foo/__init__.py')
>>> reload(foo)
Hello
<module 'foo' from 'foo/__init__.py'>
>>> foo.__file__
'foo/__init__.py'
>>>
History
Date User Action Args
2013-10-31 11:53:39ncoghlansetrecipients: + ncoghlan, brett.cannon, pje, Arfrever, eric.snow
2013-10-31 11:53:39ncoghlansetmessageid: <1383220419.12.0.755328915545.issue19413@psf.upfronthosting.co.za>
2013-10-31 11:53:39ncoghlanlinkissue19413 messages
2013-10-31 11:53:38ncoghlancreate