From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 7 Jul 2026 17:26:05 +0000 (+0200) Subject: [3.15] gh-153210: Restore accidental `array.ArrayType` removal (GH-153261) (#153274) X-Git-Tag: v3.15.0b4~85 X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=557e99497942e5f965d11aa07cdf15ab36f6ee74;p=thirdparty%2FPython%2Fcpython.git [3.15] gh-153210: Restore accidental `array.ArrayType` removal (GH-153261) (#153274) gh-153210: Restore accidental `array.ArrayType` removal (GH-153261) (cherry picked from commit ac2e14b4e29b2d11a14d289969cfffc298ea75d9) Co-authored-by: sobolevn --- diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index b24d07033016..42213120fb6c 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -38,6 +38,11 @@ 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) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 88869f2b22e4..a775896db874 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -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) {