summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-10-06 00:20:18 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-10-06 00:20:18 (GMT)
commit3472fafe745954d1882658f21e54865662f62788 (patch)
treeb2d4640ab49a69f6ecbc0a3de565da5be1c3fa3c /Lib
parentf77cdbeff71b24debf32c9c6605148ae002be5e2 (diff)
parent9259c21a63ea5c342936a18317d455f747248b2f (diff)
downloadcpython-3472fafe745954d1882658f21e54865662f62788.zip
cpython-3472fafe745954d1882658f21e54865662f62788.tar.gz
cpython-3472fafe745954d1882658f21e54865662f62788.tar.bz2
merge
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/abc.py4
-rw-r--r--Lib/test/test_bytes.py9
-rw-r--r--Lib/test/test_dict.py3
-rw-r--r--Lib/test/test_importlib/test_abc.py1
-rw-r--r--Lib/test/test_sys.py2
5 files changed, 16 insertions, 3 deletions
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
index dcbe010..01de67d 100644
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -188,7 +188,7 @@ class InspectLoader(Loader):
load_module = _bootstrap._LoaderBasics.load_module
_register(InspectLoader, machinery.BuiltinImporter, machinery.FrozenImporter,
- machinery.ExtensionFileLoader, _bootstrap.NamespaceLoader)
+ _bootstrap.NamespaceLoader)
class ExecutionLoader(InspectLoader):
@@ -237,7 +237,7 @@ class ExecutionLoader(InspectLoader):
super().init_module_attrs(module)
_bootstrap._init_file_attrs(self, module)
-_register(machinery.ExtensionFileLoader)
+_register(ExecutionLoader, machinery.ExtensionFileLoader)
class FileLoader(_bootstrap.FileLoader, ResourceLoader, ExecutionLoader):
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index f12f911..847c7a6 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -909,6 +909,15 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
with self.assertRaises(ValueError):
b[3:4] = elem
+ def test_setslice_extend(self):
+ # Exercise the resizing logic (see issue #19087)
+ b = bytearray(range(100))
+ self.assertEqual(list(b), list(range(100)))
+ del b[:10]
+ self.assertEqual(list(b), list(range(10, 100)))
+ b.extend(range(100, 110))
+ self.assertEqual(list(b), list(range(10, 110)))
+
def test_extended_set_del_slice(self):
indices = (0, None, 1, 3, 19, 300, 1<<333, -1, -2, -31, -300)
for start in indices:
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index d1f3192..a388959 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -45,6 +45,9 @@ class DictTest(unittest.TestCase):
self.assertEqual(set(d.keys()), set())
d = {'a': 1, 'b': 2}
k = d.keys()
+ self.assertEqual(set(k), {'a', 'b'})
+ self.assertIn('a', k)
+ self.assertIn('b', k)
self.assertIn('a', d)
self.assertIn('b', d)
self.assertRaises(TypeError, d.keys, None)
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
index bfdd6f1..979a481 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -100,6 +100,7 @@ Frozen_InspectLoaderInheritanceTests, Source_InspectLoaderInheritanceTests = tes
class ExecutionLoader(InheritanceTests):
superclass_names = ['InspectLoader']
+ subclass_names = ['ExtensionFileLoader']
tests = create_inheritance_tests(ExecutionLoader)
Frozen_ExecutionLoaderInheritanceTests, Source_ExecutionLoaderInheritanceTests = tests
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 30eca4a..70b55b2 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -721,7 +721,7 @@ class SizeofTest(unittest.TestCase):
samples = [b'', b'u'*100000]
for sample in samples:
x = bytearray(sample)
- check(x, vsize('inP') + x.__alloc__())
+ check(x, vsize('n2Pi') + x.__alloc__())
# bytearray_iterator
check(iter(bytearray()), size('nP'))
# cell