]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-153210: Restore accidental `array.ArrayType` removal (GH-153261) (#153289)
authorsobolevn <mail@sobolevn.me>
Wed, 8 Jul 2026 15:59:28 +0000 (18:59 +0300)
committerGitHub <noreply@github.com>
Wed, 8 Jul 2026 15:59:28 +0000 (15:59 +0000)
(cherry picked from commit ac2e14b4e29b2d11a14d289969cfffc298ea75d9)

Lib/test/test_array.py
Modules/arraymodule.c

index 322b77463962a348bfcbf9b4988efa2064b0963a..331ee27179b826c1038b0883e112ed6083591299 100755 (executable)
@@ -35,6 +35,11 @@ typecodes = 'uwbBhHiIlLfdqQ'
 
 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 8e587af7169036e05b8d68ec9678a0a4e1b843ff..f92b258793ffe84daf7ecc7ae2a68b9b3d663cc3 100644 (file)
@@ -3282,6 +3282,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_GetModuleAttrString(
             "collections.abc", "MutableSequence");
     if (!mutablesequence) {