Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7efd59

Browse files
committed
Make the name of the C variables match the Python names
for chr()/chr8(). Fix function name in PyArg_ParseTuple() call.
1 parent b41bb79 commit e7efd59

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Python/bltinmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ PyDoc_STRVAR(filter_doc,
365365

366366

367367
static PyObject *
368-
builtin_chr(PyObject *self, PyObject *args)
368+
builtin_chr8(PyObject *self, PyObject *args)
369369
{
370370
long x;
371371
char s[1];
@@ -381,24 +381,24 @@ builtin_chr(PyObject *self, PyObject *args)
381381
return PyString_FromStringAndSize(s, 1);
382382
}
383383

384-
PyDoc_STRVAR(chr_doc,
384+
PyDoc_STRVAR(chr8_doc,
385385
"chr8(i) -> 8-bit character\n\
386386
\n\
387387
Return a string of one character with ordinal i; 0 <= i < 256.");
388388

389389

390390
static PyObject *
391-
builtin_unichr(PyObject *self, PyObject *args)
391+
builtin_chr(PyObject *self, PyObject *args)
392392
{
393393
long x;
394394

395-
if (!PyArg_ParseTuple(args, "l:unichr", &x))
395+
if (!PyArg_ParseTuple(args, "l:chr", &x))
396396
return NULL;
397397

398398
return PyUnicode_FromOrdinal(x);
399399
}
400400

401-
PyDoc_STRVAR(unichr_doc,
401+
PyDoc_STRVAR(chr_doc,
402402
"chr(i) -> Unicode character\n\
403403
\n\
404404
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
@@ -1975,8 +1975,8 @@ static PyMethodDef builtin_methods[] = {
19751975
{"abs", builtin_abs, METH_O, abs_doc},
19761976
{"all", builtin_all, METH_O, all_doc},
19771977
{"any", builtin_any, METH_O, any_doc},
1978-
{"chr", builtin_unichr, METH_VARARGS, unichr_doc},
1979-
{"chr8", builtin_chr, METH_VARARGS, chr_doc},
1978+
{"chr", builtin_chr, METH_VARARGS, chr_doc},
1979+
{"chr8", builtin_chr8, METH_VARARGS, chr8_doc},
19801980
{"cmp", builtin_cmp, METH_VARARGS, cmp_doc},
19811981
{"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc},
19821982
{"delattr", builtin_delattr, METH_VARARGS, delattr_doc},

0 commit comments

Comments
 (0)