Commit 10e35b30 authored by Brett Cannon's avatar Brett Cannon

Backport of r74103.

parent 5797e8b0
...@@ -346,20 +346,20 @@ class BadBytecodeFailureTests(unittest.TestCase): ...@@ -346,20 +346,20 @@ class BadBytecodeFailureTests(unittest.TestCase):
# A bad magic number should lead to an ImportError. # A bad magic number should lead to an ImportError.
name = 'mod' name = 'mod'
bad_magic = b'\x00\x00\x00\x00' bad_magic = b'\x00\x00\x00\x00'
mock = PyPycLoaderMock({}, {name: {'path': os.path.join('path', 'to', mock = PyPycLoaderMock({name: None},
'mod'), {name: {'path': os.path.join('path', 'to', 'mod'),
'magic': bad_magic}}) 'magic': bad_magic}})
with util.uncache(name): with util.uncache(name):
self.assertRaises(ImportError, mock.load_module, name) self.assertRaises(ImportError, mock.load_module, name)
def test_bad_bytecode(self): def test_bad_bytecode(self):
# Bad code object bytecode should elad to an ImportError. # Bad code object bytecode should lead to an ImportError.
name = 'mod' name = 'mod'
mock = PyPycLoaderMock({}, {name: {'path': os.path.join('path', 'to', mock = PyPycLoaderMock({name: None},
'mod'), {name: {'path': os.path.join('path', 'to', 'mod'),
'bc': b''}}) 'bc': b''}})
with util.uncache(name): with util.uncache(name):
self.assertRaises(ImportError, mock.load_module, name) self.assertRaises(EOFError, mock.load_module, name)
def raise_ImportError(*args, **kwargs): def raise_ImportError(*args, **kwargs):
......
...@@ -62,6 +62,12 @@ Build ...@@ -62,6 +62,12 @@ Build
- Issue 5390: Add uninstall icon independent of whether file - Issue 5390: Add uninstall icon independent of whether file
extensions are installed. extensions are installed.
Test
----
- Fix a test in importlib.test.source.test_abc_loader that was incorrectly
testing when a .pyc file lacked an code object bytecode.
What's New in Python 3.1? What's New in Python 3.1?
========================= =========================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment