There was an error while loading. Please reload this page.
array.ArrayType
1 parent 08759ff commit ac2e14bCopy full SHA for ac2e14b
2 files changed
Lib/test/test_array.py
@@ -31,6 +31,11 @@ def __init__(self, typecode, newarg=None):
31
32
class MiscTest(unittest.TestCase):
33
34
+ def test_array_type_importable(self):
35
+ from array import ArrayType
36
+
37
+ self.assertIs(array.array, ArrayType)
38
39
def test_array_is_sequence(self):
40
self.assertIsInstance(array.array("B"), collections.abc.MutableSequence)
41
self.assertIsInstance(array.array("B"), collections.abc.Reversible)
Modules/arraymodule.c
@@ -3401,6 +3401,12 @@ array_modexec(PyObject *m)
3401
CREATE_TYPE(m, state->ArrayIterType, &arrayiter_spec);
3402
Py_SET_TYPE(state->ArrayIterType, &PyType_Type);
3403
3404
+ // Older undocumented alias:
3405
+ if (PyModule_AddObjectRef(m, "ArrayType",
3406
+ (PyObject *)state->ArrayType) < 0) {
3407
+ return -1;
3408
+ }
3409
3410
PyObject *mutablesequence = PyImport_ImportModuleAttrString(
3411
"collections.abc", "MutableSequence");
3412
if (!mutablesequence) {
0 commit comments