gh-117431: Adapt bytes and bytearray .startswith() and .endswith() to Argument Clinic (#117495)

This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used.
This commit is contained in:
Erlend E. Aasland 2024-04-03 13:11:14 +02:00 committed by GitHub
parent 1dc1521042
commit 595bb496b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 324 additions and 61 deletions

View file

@ -32,8 +32,12 @@ extern PyObject *_Py_bytes_rfind(const char *str, Py_ssize_t len, PyObject *args
extern PyObject *_Py_bytes_rindex(const char *str, Py_ssize_t len, PyObject *args);
extern PyObject *_Py_bytes_count(const char *str, Py_ssize_t len, PyObject *args);
extern int _Py_bytes_contains(const char *str, Py_ssize_t len, PyObject *arg);
extern PyObject *_Py_bytes_startswith(const char *str, Py_ssize_t len, PyObject *args);
extern PyObject *_Py_bytes_endswith(const char *str, Py_ssize_t len, PyObject *args);
extern PyObject *_Py_bytes_startswith(const char *str, Py_ssize_t len,
PyObject *subobj, Py_ssize_t start,
Py_ssize_t end);
extern PyObject *_Py_bytes_endswith(const char *str, Py_ssize_t len,
PyObject *subobj, Py_ssize_t start,
Py_ssize_t end);
/* The maketrans() static method. */
extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to);