Skip to content

Commit d2d307a

Browse files
Fix blurb and add test
1 parent 9d5fb14 commit d2d307a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Lib/test/test_array.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,14 @@ def test_typecode_u_deprecation(self):
12551255
with self.assertWarns(DeprecationWarning):
12561256
array.array("u")
12571257

1258+
def test_empty_string_mem_leak_gh140474(self):
1259+
with warnings.catch_warnings():
1260+
warnings.simplefilter('ignore', DeprecationWarning)
1261+
for _ in range(1000):
1262+
a = array.array('u', '')
1263+
self.assertEqual(len(a), 0)
1264+
self.assertEqual(a.typecode, 'u')
1265+
12581266

12591267
class UCS4Test(UnicodeTest):
12601268
typecode = 'w'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Fix memory leak in :class:`array.array` when creating arrays from empty
2-
:class:`str`.
1+
Fix memory leak in :class:`array.array` when creating arrays from an empty
2+
:class:`str` and the ``u`` type code.

0 commit comments

Comments
 (0)