Show More
@@ -41,6 +41,10 b' class _lazyloaderex(importlib.util.LazyL' | |||||
41 | """Make the module load lazily.""" |
|
41 | """Make the module load lazily.""" | |
42 | with tracing.log('demandimport %s', module): |
|
42 | with tracing.log('demandimport %s', module): | |
43 | if _deactivated or module.__name__ in ignores: |
|
43 | if _deactivated or module.__name__ in ignores: | |
|
44 | # Reset the loader on the module as super() does (issue6725) | |||
|
45 | module.__spec__.loader = self.loader | |||
|
46 | module.__loader__ = self.loader | |||
|
47 | ||||
44 | self.loader.exec_module(module) |
|
48 | self.loader.exec_module(module) | |
45 | else: |
|
49 | else: | |
46 | super().exec_module(module) |
|
50 | super().exec_module(module) |
@@ -234,3 +234,11 b" assert 'ftplib' not in sys.modules" | |||||
234 | zipfileimp = __import__('ftplib', globals(), locals(), ['unknownattr']) |
|
234 | zipfileimp = __import__('ftplib', globals(), locals(), ['unknownattr']) | |
235 | assert f(zipfileimp) == "<module 'ftplib' from '?'>", f(zipfileimp) |
|
235 | assert f(zipfileimp) == "<module 'ftplib' from '?'>", f(zipfileimp) | |
236 | assert not util.safehasattr(zipfileimp, 'unknownattr') |
|
236 | assert not util.safehasattr(zipfileimp, 'unknownattr') | |
|
237 | ||||
|
238 | ||||
|
239 | # test deactivation for issue6725 | |||
|
240 | del sys.modules['telnetlib'] | |||
|
241 | with demandimport.deactivated(): | |||
|
242 | import telnetlib | |||
|
243 | assert telnetlib.__loader__ == telnetlib.__spec__.loader | |||
|
244 | assert telnetlib.__loader__.get_resource_reader |
General Comments 0
You need to be logged in to leave comments.
Login now