From: sobolevn Date: Tue, 7 Jul 2026 16:09:02 +0000 (+0300) Subject: gh-153210: Restore accidental `array.ArrayType` removal (#153261) X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=ac2e14b4e29b2d11a14d289969cfffc298ea75d9;p=thirdparty%2FPython%2Fcpython.git gh-153210: Restore accidental `array.ArrayType` removal (#153261) --- diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 27bd63bde08e..b5f6603defde 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -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) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 45aad5d6fe21..2b1373dbe6eb 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -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) {