bpo-36346: Emit DeprecationWarning for PyArg_Parse() with 'u' or 'Z'. by methane · Pull Request #20927 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 59 additions & 24 deletions Lib/test/test_getargs2.py
6 changes: 4 additions & 2 deletions Lib/test/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2362,12 +2362,14 @@ def test_resize(self):
text = 'a' * length + 'b'

# fill wstr internal field
abc = getargs_u(text)
with self.assertWarns(DeprecationWarning):
abc = getargs_u(text)
self.assertEqual(abc, text)

# resize text: wstr field must be cleared and then recomputed
text += 'c'
abcdef = getargs_u(text)
with self.assertWarns(DeprecationWarning):
abcdef = getargs_u(text)
self.assertNotEqual(abc, abcdef)
self.assertEqual(abcdef, text)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``PyArg_Parse*()`` functions now emits ``DeprecationWarning`` when ``u`` or
``Z`` format is used. See :pep:`623` for detail.
5 changes: 4 additions & 1 deletion Python/getargs.c