Eric Snow added the comment:

This is actually a problem with importlib.reload() (which imp.reload() simply 
wraps).  The attached patch provides a test that reproduces the error.  I'll 
work on a fix ASAP.

Interestingly, the kind of failure depends on frozen vs. source importlib:

======================================================================
ERROR: test_reload_submodule (test.test_importlib.test_api.Frozen_ReloadTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_importlib/test_api.py", line 430, in test_reload_submodule
    self.init.reload(ham)
  File "Lib/importlib/__init__.py", line 161, in reload
    methods.exec(module)
  File "<frozen importlib._bootstrap>", line 1134, in exec
AttributeError: 'NoneType' object has no attribute 'name'

======================================================================
ERROR: test_reload_submodule (test.test_importlib.test_api.Source_ReloadTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_importlib/test_api.py", line 430, in test_reload_submodule
    self.init.reload(ham)
  File "Lib/importlib/__init__.py", line 158, in reload
    raise ImportError(msg.format(parent_name), name=parent_name)
ImportError: parent 'spam' not in sys.modules

----------------------------------------------------------------------

----------
keywords: +patch
priority: normal -> critical
stage: test needed -> needs patch
title: imp.reload problem with submodule -> reload problem with submodule
Added file: http://bugs.python.org/file33033/issue19851-test.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19851>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to