mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
gh-117709: Add vectorcall support for str() with positional-only arguments (#117746)
Fall back to tp_call() for cases when arguments are passed by name. Co-authored-by: Donghee Na <donghee.na@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
671cb22094
commit
044dc496e0
3 changed files with 72 additions and 0 deletions
|
@ -2651,6 +2651,24 @@ class StrTest(string_tests.StringLikeTest,
|
|||
proc = assert_python_failure('-X', 'dev', '-c', code)
|
||||
self.assertEqual(proc.rc, 10, proc)
|
||||
|
||||
def test_str_invalid_call(self):
|
||||
check = lambda *a, **kw: self.assertRaises(TypeError, str, *a, **kw)
|
||||
|
||||
# too many args
|
||||
check(1, "", "", 1)
|
||||
|
||||
# no such kw arg
|
||||
check(test=1)
|
||||
|
||||
# 'encoding' must be str
|
||||
check(1, encoding=1)
|
||||
check(1, 1)
|
||||
|
||||
# 'errors' must be str
|
||||
check(1, errors=1)
|
||||
check(1, "", errors=1)
|
||||
check(1, 1, 1)
|
||||
|
||||
|
||||
class StringModuleTest(unittest.TestCase):
|
||||
def test_formatter_parser(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue