Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-153210: Restore accidental array.ArrayType removal (GH-153261)
(cherry picked from commit ac2e14b)

Co-authored-by: sobolevn <mail@sobolevn.me>
  • Loading branch information
sobolevn authored and miss-islington committed Jul 7, 2026
commit 087ab15326b5842107b0e859b125e94ab7a144e2
5 changes: 5 additions & 0 deletions Lib/test/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def __init__(self, typecode, newarg=None):

class MiscTest(unittest.TestCase):

def test_array_type_importable(self):
from array import ArrayType

self.assertIs(array.array, ArrayType)

def test_array_is_sequence(self):
self.assertIsInstance(array.array("B"), collections.abc.MutableSequence)
self.assertIsInstance(array.array("B"), collections.abc.Reversible)
Expand Down
6 changes: 6 additions & 0 deletions Modules/arraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3502,6 +3502,12 @@ array_modexec(PyObject *m)
CREATE_TYPE(m, state->ArrayIterType, &arrayiter_spec);
Py_SET_TYPE(state->ArrayIterType, &PyType_Type);

// Older undocumented alias:
if (PyModule_AddObjectRef(m, "ArrayType",
(PyObject *)state->ArrayType) < 0) {
return -1;
}

PyObject *mutablesequence = PyImport_ImportModuleAttrString(
"collections.abc", "MutableSequence");
if (!mutablesequence) {
Expand Down
Loading