mirror of
https://github.com/python/cpython.git
synced 2025-11-28 22:18:54 +00:00
Merge from 3.4 (for #21499).
This commit is contained in:
commit
e1c9e5270a
2 changed files with 10 additions and 7 deletions
|
|
@ -241,13 +241,13 @@ class ReloadTests:
|
||||||
'__file__': path,
|
'__file__': path,
|
||||||
'__cached__': cached,
|
'__cached__': cached,
|
||||||
'__doc__': None,
|
'__doc__': None,
|
||||||
'__builtins__': __builtins__,
|
|
||||||
}
|
}
|
||||||
support.create_empty_file(path)
|
support.create_empty_file(path)
|
||||||
module = self.init.import_module(name)
|
module = self.init.import_module(name)
|
||||||
ns = vars(module)
|
ns = vars(module).copy()
|
||||||
loader = ns.pop('__loader__')
|
loader = ns.pop('__loader__')
|
||||||
spec = ns.pop('__spec__')
|
spec = ns.pop('__spec__')
|
||||||
|
ns.pop('__builtins__', None) # An implementation detail.
|
||||||
self.assertEqual(spec.name, name)
|
self.assertEqual(spec.name, name)
|
||||||
self.assertEqual(spec.loader, loader)
|
self.assertEqual(spec.loader, loader)
|
||||||
self.assertEqual(loader.path, path)
|
self.assertEqual(loader.path, path)
|
||||||
|
|
@ -263,14 +263,14 @@ class ReloadTests:
|
||||||
'__cached__': cached,
|
'__cached__': cached,
|
||||||
'__path__': [os.path.dirname(init_path)],
|
'__path__': [os.path.dirname(init_path)],
|
||||||
'__doc__': None,
|
'__doc__': None,
|
||||||
'__builtins__': __builtins__,
|
|
||||||
}
|
}
|
||||||
os.mkdir(name)
|
os.mkdir(name)
|
||||||
os.rename(path, init_path)
|
os.rename(path, init_path)
|
||||||
reloaded = self.init.reload(module)
|
reloaded = self.init.reload(module)
|
||||||
ns = vars(reloaded)
|
ns = vars(reloaded).copy()
|
||||||
loader = ns.pop('__loader__')
|
loader = ns.pop('__loader__')
|
||||||
spec = ns.pop('__spec__')
|
spec = ns.pop('__spec__')
|
||||||
|
ns.pop('__builtins__', None) # An implementation detail.
|
||||||
self.assertEqual(spec.name, name)
|
self.assertEqual(spec.name, name)
|
||||||
self.assertEqual(spec.loader, loader)
|
self.assertEqual(spec.loader, loader)
|
||||||
self.assertIs(reloaded, module)
|
self.assertIs(reloaded, module)
|
||||||
|
|
@ -295,10 +295,11 @@ class ReloadTests:
|
||||||
with open(bad_path, 'w') as init_file:
|
with open(bad_path, 'w') as init_file:
|
||||||
init_file.write('eggs = None')
|
init_file.write('eggs = None')
|
||||||
module = self.init.import_module(name)
|
module = self.init.import_module(name)
|
||||||
ns = vars(module)
|
ns = vars(module).copy()
|
||||||
loader = ns.pop('__loader__')
|
loader = ns.pop('__loader__')
|
||||||
path = ns.pop('__path__')
|
path = ns.pop('__path__')
|
||||||
spec = ns.pop('__spec__')
|
spec = ns.pop('__spec__')
|
||||||
|
ns.pop('__builtins__', None) # An implementation detail.
|
||||||
self.assertEqual(spec.name, name)
|
self.assertEqual(spec.name, name)
|
||||||
self.assertIs(spec.loader, None)
|
self.assertIs(spec.loader, None)
|
||||||
self.assertIsNot(loader, None)
|
self.assertIsNot(loader, None)
|
||||||
|
|
@ -319,14 +320,14 @@ class ReloadTests:
|
||||||
'__cached__': cached,
|
'__cached__': cached,
|
||||||
'__path__': [os.path.dirname(init_path)],
|
'__path__': [os.path.dirname(init_path)],
|
||||||
'__doc__': None,
|
'__doc__': None,
|
||||||
'__builtins__': __builtins__,
|
|
||||||
'eggs': None,
|
'eggs': None,
|
||||||
}
|
}
|
||||||
os.rename(bad_path, init_path)
|
os.rename(bad_path, init_path)
|
||||||
reloaded = self.init.reload(module)
|
reloaded = self.init.reload(module)
|
||||||
ns = vars(reloaded)
|
ns = vars(reloaded).copy()
|
||||||
loader = ns.pop('__loader__')
|
loader = ns.pop('__loader__')
|
||||||
spec = ns.pop('__spec__')
|
spec = ns.pop('__spec__')
|
||||||
|
ns.pop('__builtins__', None) # An implementation detail.
|
||||||
self.assertEqual(spec.name, name)
|
self.assertEqual(spec.name, name)
|
||||||
self.assertEqual(spec.loader, loader)
|
self.assertEqual(spec.loader, loader)
|
||||||
self.assertIs(reloaded, module)
|
self.assertIs(reloaded, module)
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,8 @@ Library
|
||||||
|
|
||||||
- Issue #20884: Don't assume that __file__ is defined on importlib.__init__.
|
- Issue #20884: Don't assume that __file__ is defined on importlib.__init__.
|
||||||
|
|
||||||
|
- Issue #21499: Ignore __builtins__ in several test_importlib.test_api tests.
|
||||||
|
|
||||||
- Issue #20627: xmlrpc.client.ServerProxy is now a context manager.
|
- Issue #20627: xmlrpc.client.ServerProxy is now a context manager.
|
||||||
|
|
||||||
- Issue #19165: The formatter module now raises DeprecationWarning instead of
|
- Issue #19165: The formatter module now raises DeprecationWarning instead of
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue