Commit 36ff3d23 authored by Marius Wachtler's avatar Marius Wachtler

Switch calling convention of string.replace() away from varargs

parent b9764e2d
...@@ -899,14 +899,19 @@ replace(PyStringObject *self, ...@@ -899,14 +899,19 @@ replace(PyStringObject *self,
} }
} }
PyObject* string_replace(PyStringObject *self, PyObject *args) // Pyston change: don't use varags calling convention
// PyObject* string_replace(PyStringObject *self, PyObject *args)
PyObject* string_replace(PyStringObject *self, PyObject *from, PyObject* to, PyObject** args)
{ {
PyObject* _count = args[0];
Py_ssize_t count = -1; Py_ssize_t count = -1;
PyObject *from, *to;
const char *from_s, *to_s; const char *from_s, *to_s;
Py_ssize_t from_len, to_len; Py_ssize_t from_len, to_len;
if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) // Pyston change: don't use varags calling convention
// if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count))
// return NULL;
if (_count && !PyArg_ParseSingle(_count, 3, "replace", "n", &count))
return NULL; return NULL;
if (PyString_Check(from)) { if (PyString_Check(from)) {
......
...@@ -2780,7 +2780,7 @@ static PyMethodDef string_methods[] = { ...@@ -2780,7 +2780,7 @@ static PyMethodDef string_methods[] = {
{ "rindex", (PyCFunction)string_rindex, METH_VARARGS, NULL }, { "rindex", (PyCFunction)string_rindex, METH_VARARGS, NULL },
{ "rfind", (PyCFunction)string_rfind, METH_VARARGS, NULL }, { "rfind", (PyCFunction)string_rfind, METH_VARARGS, NULL },
{ "expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, NULL }, { "expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, NULL },
{ "replace", (PyCFunction)string_replace, METH_VARARGS, NULL }, { "replace", (PyCFunction)string_replace, METH_O3 | METH_D1, NULL },
{ "splitlines", (PyCFunction)string_splitlines, METH_VARARGS, NULL }, { "splitlines", (PyCFunction)string_splitlines, METH_VARARGS, NULL },
{ "zfill", (PyCFunction)string_zfill, METH_VARARGS, NULL }, { "zfill", (PyCFunction)string_zfill, METH_VARARGS, NULL },
{ "__format__", (PyCFunction)string__format__, METH_VARARGS, NULL }, { "__format__", (PyCFunction)string__format__, METH_VARARGS, NULL },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment