]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-153210: Restore accidental `array.ArrayType` removal (GH-153261) (#153275)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 7 Jul 2026 17:24:07 +0000 (19:24 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Jul 2026 17:24:07 +0000 (17:24 +0000)
gh-153210: Restore accidental `array.ArrayType` removal (GH-153261)
(cherry picked from commit ac2e14b4e29b2d11a14d289969cfffc298ea75d9)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_array.py
Modules/arraymodule.c

index 788095e5dfa0261aa050e32060501b616cb6af3a..8cf669935f923e5d3d83be04b7d074d19c4df8df 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 c4863b143dfdad239637a568f11b0a397f4f0afa..532433d2c4865552d14037686ce9890d7c4dc7f2 100644 (file)
@@ -3295,6 +3295,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) {