#3479: unichr(2**32) used to return u'\x00'.

The argument was fetched in a long, but PyUnicode_FromOrdinal takes an int.

(why doesn't gcc issue a truncation warning in this case?)
This commit is contained in:
Amaury Forgeot d'Arc 2008-07-31 21:28:03 +00:00
parent e7d8be80ba
commit 39fd672dfe
3 changed files with 7 additions and 2 deletions

View file

@ -394,9 +394,9 @@ Return a string of one character with ordinal i; 0 <= i < 256.");
static PyObject *
builtin_unichr(PyObject *self, PyObject *args)
{
long x;
int x;
if (!PyArg_ParseTuple(args, "l:unichr", &x))
if (!PyArg_ParseTuple(args, "i:unichr", &x))
return NULL;
return PyUnicode_FromOrdinal(x);