mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-117431: Adapt str.find and friends to Argument Clinic (#117468)
This change gives a significant speedup, as the METH_FASTCALL calling convention is now used. The following methods are adapted: - str.count - str.find - str.index - str.rfind - str.rindex
This commit is contained in:
parent
345194de8c
commit
7ecd55d604
4 changed files with 444 additions and 222 deletions
|
@ -1503,15 +1503,15 @@ class StringLikeTest(BaseTest):
|
|||
# issue 11828
|
||||
s = 'hello'
|
||||
x = 'x'
|
||||
self.assertRaisesRegex(TypeError, r'^find\(', s.find,
|
||||
self.assertRaisesRegex(TypeError, r'^find\b', s.find,
|
||||
x, None, None, None)
|
||||
self.assertRaisesRegex(TypeError, r'^rfind\(', s.rfind,
|
||||
self.assertRaisesRegex(TypeError, r'^rfind\b', s.rfind,
|
||||
x, None, None, None)
|
||||
self.assertRaisesRegex(TypeError, r'^index\(', s.index,
|
||||
self.assertRaisesRegex(TypeError, r'^index\b', s.index,
|
||||
x, None, None, None)
|
||||
self.assertRaisesRegex(TypeError, r'^rindex\(', s.rindex,
|
||||
self.assertRaisesRegex(TypeError, r'^rindex\b', s.rindex,
|
||||
x, None, None, None)
|
||||
self.assertRaisesRegex(TypeError, r'^count\(', s.count,
|
||||
self.assertRaisesRegex(TypeError, r'^count\b', s.count,
|
||||
x, None, None, None)
|
||||
self.assertRaisesRegex(TypeError, r'^startswith\b', s.startswith,
|
||||
x, None, None, None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue