mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Python 3.7 METH_FASTCALL backport (#406)
This commit is contained in:
parent
fec396037a
commit
83b743cf96
103 changed files with 2949 additions and 3356 deletions
|
@ -18,7 +18,7 @@ PyDoc_STRVAR(bytes_split__doc__,
|
|||
" -1 (the default value) means no limit.");
|
||||
|
||||
#define BYTES_SPLIT_METHODDEF \
|
||||
{"split", (PyCFunction)bytes_split, METH_FASTCALL, bytes_split__doc__},
|
||||
{"split", (PyCFunction)bytes_split, METH_FASTCALL|METH_KEYWORDS, bytes_split__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_split_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
|
||||
|
@ -137,7 +137,7 @@ PyDoc_STRVAR(bytes_rsplit__doc__,
|
|||
"Splitting is done starting at the end of the bytes and working to the front.");
|
||||
|
||||
#define BYTES_RSPLIT_METHODDEF \
|
||||
{"rsplit", (PyCFunction)bytes_rsplit, METH_FASTCALL, bytes_rsplit__doc__},
|
||||
{"rsplit", (PyCFunction)bytes_rsplit, METH_FASTCALL|METH_KEYWORDS, bytes_rsplit__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_rsplit_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
|
||||
|
@ -191,7 +191,7 @@ static PyObject *
|
|||
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
|
||||
|
||||
static PyObject *
|
||||
bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *bytes = Py_None;
|
||||
|
@ -201,10 +201,6 @@ bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kw
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_strip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -226,7 +222,7 @@ static PyObject *
|
|||
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
|
||||
|
||||
static PyObject *
|
||||
bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *bytes = Py_None;
|
||||
|
@ -236,10 +232,6 @@ bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *k
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_lstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -261,7 +253,7 @@ static PyObject *
|
|||
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
|
||||
|
||||
static PyObject *
|
||||
bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *bytes = Py_None;
|
||||
|
@ -271,10 +263,6 @@ bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *k
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_rstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -294,7 +282,7 @@ PyDoc_STRVAR(bytes_translate__doc__,
|
|||
"The remaining characters are mapped through the given translation table.");
|
||||
|
||||
#define BYTES_TRANSLATE_METHODDEF \
|
||||
{"translate", (PyCFunction)bytes_translate, METH_FASTCALL, bytes_translate__doc__},
|
||||
{"translate", (PyCFunction)bytes_translate, METH_FASTCALL|METH_KEYWORDS, bytes_translate__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_translate_impl(PyBytesObject *self, PyObject *table,
|
||||
|
@ -337,7 +325,7 @@ static PyObject *
|
|||
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to);
|
||||
|
||||
static PyObject *
|
||||
bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_buffer frm = {NULL, NULL};
|
||||
|
@ -347,10 +335,6 @@ bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames
|
|||
&frm, &to)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_maketrans_impl(&frm, &to);
|
||||
|
||||
exit:
|
||||
|
@ -387,7 +371,7 @@ bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
|
|||
Py_ssize_t count);
|
||||
|
||||
static PyObject *
|
||||
bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_buffer old = {NULL, NULL};
|
||||
|
@ -398,10 +382,6 @@ bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *
|
|||
&old, &new, &count)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("replace", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_replace_impl(self, &old, &new, count);
|
||||
|
||||
exit:
|
||||
|
@ -433,7 +413,7 @@ PyDoc_STRVAR(bytes_decode__doc__,
|
|||
" can handle UnicodeDecodeErrors.");
|
||||
|
||||
#define BYTES_DECODE_METHODDEF \
|
||||
{"decode", (PyCFunction)bytes_decode, METH_FASTCALL, bytes_decode__doc__},
|
||||
{"decode", (PyCFunction)bytes_decode, METH_FASTCALL|METH_KEYWORDS, bytes_decode__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_decode_impl(PyBytesObject *self, const char *encoding,
|
||||
|
@ -468,7 +448,7 @@ PyDoc_STRVAR(bytes_splitlines__doc__,
|
|||
"true.");
|
||||
|
||||
#define BYTES_SPLITLINES_METHODDEF \
|
||||
{"splitlines", (PyCFunction)bytes_splitlines, METH_FASTCALL, bytes_splitlines__doc__},
|
||||
{"splitlines", (PyCFunction)bytes_splitlines, METH_FASTCALL|METH_KEYWORDS, bytes_splitlines__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_splitlines_impl(PyBytesObject *self, int keepends);
|
||||
|
@ -520,4 +500,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=debf785947e0eec2 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=fc9e02359cc56d36 input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue