]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-153210: Restore accidental `array.ArrayType` removal (#153261)
authorsobolevn <mail@sobolevn.me>
Tue, 7 Jul 2026 16:09:02 +0000 (19:09 +0300)
committerGitHub <noreply@github.com>
Tue, 7 Jul 2026 16:09:02 +0000 (19:09 +0300)
Lib/test/test_array.py
Modules/arraymodule.c

index 27bd63bde08eb8b0ddd252f03180586632e8ef28..b5f6603defde5c5f2d56c633f079b417d532551c 100755 (executable)
@@ -31,6 +31,11 @@ typecodes = array.typecodes
 
 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)
index 45aad5d6fe2191832eb7e8383f602c0c1a07274a..2b1373dbe6eb46117f3eac7f98ee6b10381cdd11 100644 (file)
@@ -3401,6 +3401,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) {