Skip to content

gh-117431: Adapt str.find and friends to use the METH_FASTCALL calling convention #117468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 3, 2024
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
10 changes: 5 additions & 5 deletions Lib/test/string_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,15 +1503,15 @@ def test_find_etc_raise_correct_error_messages(self):
# 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
Improve the performance of :meth:`str.startswith` and :meth:`str.endswith`
by adapting them to the :c:macro:`METH_FASTCALL` calling convention.
Improve the performance of the following :class:`str` methods
by adapting them to the :c:macro:`METH_FASTCALL` calling convention:

* :meth:`~str.count`
* :meth:`~str.endswith`
* :meth:`~str.find`
* :meth:`~str.index`
* :meth:`~str.rfind`
* :meth:`~str.rindex`
* :meth:`~str.startswith`
281 changes: 280 additions & 1 deletion Objects/clinic/unicodeobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading