mirror of
https://github.com/python/cpython.git
synced 2026-07-28 04:42:09 -04:00
gh-153210: Restore accidental array.ArrayType removal (#153261)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user