Issue #8850: Remove "w" and "w#" formats from PyArg_Parse*() functions, use

"w*" format instead. Add tests for "w*" format.
This commit is contained in:
Victor Stinner 2010-06-25 00:02:38 +00:00
parent 21e09487ac
commit 25e8ec4724
6 changed files with 61 additions and 64 deletions

View file

@ -375,6 +375,16 @@ class Bytes_TestCase(unittest.TestCase):
self.assertRaises(TypeError, getargs_y_hash, memoryview(b'memoryview'))
self.assertRaises(TypeError, getargs_y_hash, None)
def test_w_star(self):
# getargs_w_star() modifies first and last byte
from _testcapi import getargs_w_star
self.assertRaises(TypeError, getargs_w_star, 'abc\xe9')
self.assertRaises(TypeError, getargs_w_star, b'bytes')
self.assertRaises(TypeError, getargs_w_star, b'nul:\0')
self.assertEqual(getargs_w_star(bytearray(b'bytearray')), b'[ytearra]')
self.assertEqual(getargs_w_star(memoryview(b'memoryview')), b'[emoryvie]')
self.assertRaises(TypeError, getargs_w_star, None)
class Unicode_TestCase(unittest.TestCase):
def test_u(self):