diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 426454dbb..db09e50e8 100644 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -1255,7 +1255,6 @@ class UnicodeTest(StringTest, unittest.TestCase): self.assertRaises(ValueError, a.tounicode) self.assertRaises(ValueError, str, a) - @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: DeprecationWarning not triggered def test_typecode_u_deprecation(self): with self.assertWarns(DeprecationWarning): array.array("u") diff --git a/crates/stdlib/src/array.rs b/crates/stdlib/src/array.rs index 1306cdb2d..9877d0dcc 100644 --- a/crates/stdlib/src/array.rs +++ b/crates/stdlib/src/array.rs @@ -35,6 +35,7 @@ mod array { SaturatedSlice, SequenceIndex, SequenceIndexOp, SliceableSequenceMutOp, SliceableSequenceOp, }, + stdlib::warnings, types::{ AsBuffer, AsMapping, AsSequence, Comparable, Constructor, IterNext, Iterable, PyComparisonOp, Representable, SelfIter, @@ -645,6 +646,15 @@ mod array { return Err(vm.new_type_error("array.array() takes no keyword arguments")); } + if spec == 'u' { + warnings::warn( + vm.ctx.exceptions.deprecation_warning, + "The 'u' type code is deprecated and will be removed in Python 3.16".to_owned(), + 1, + vm, + )?; + } + let mut array = ArrayContentType::from_char(spec).map_err(|err| vm.new_value_error(err))?;