mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
gh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502)
This change gives a significant speedup, as the METH_FASTCALL calling convention is now used. The following bytes and bytearray methods are adapted: - count() - find() - index() - rfind() - rindex() Co-authored-by: Inada Naoki <songofacandy@gmail.com>
This commit is contained in:
parent
49fc1414b5
commit
deb921f851
8 changed files with 709 additions and 170 deletions
|
|
@ -26,11 +26,16 @@ extern void _Py_bytes_title(char *result, const char *s, Py_ssize_t len);
|
|||
extern void _Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len);
|
||||
extern void _Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len);
|
||||
|
||||
extern PyObject *_Py_bytes_find(const char *str, Py_ssize_t len, PyObject *args);
|
||||
extern PyObject *_Py_bytes_index(const char *str, Py_ssize_t len, PyObject *args);
|
||||
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 PyObject *_Py_bytes_find(const char *str, Py_ssize_t len, PyObject *sub,
|
||||
Py_ssize_t start, Py_ssize_t end);
|
||||
extern PyObject *_Py_bytes_index(const char *str, Py_ssize_t len, PyObject *sub,
|
||||
Py_ssize_t start, Py_ssize_t end);
|
||||
extern PyObject *_Py_bytes_rfind(const char *str, Py_ssize_t len, PyObject *sub,
|
||||
Py_ssize_t start, Py_ssize_t end);
|
||||
extern PyObject *_Py_bytes_rindex(const char *str, Py_ssize_t len, PyObject *sub,
|
||||
Py_ssize_t start, Py_ssize_t end);
|
||||
extern PyObject *_Py_bytes_count(const char *str, Py_ssize_t len, PyObject *sub,
|
||||
Py_ssize_t start, Py_ssize_t end);
|
||||
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 *subobj, Py_ssize_t start,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue