From: Walter Dörwald Date: Wed, 8 Jan 2003 22:01:33 +0000 (+0000) Subject: Fix charmapencode_lookup(), so that a None value in the mapping X-Git-Tag: v2.3c1~2510 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=adc727490b521b1de27088b160382396d7b52a8a;p=python Fix charmapencode_lookup(), so that a None value in the mapping is treated as "character maps to " and not as "character mapping must return integer, None or str". --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 1e4907ac42..07579aa383 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2736,6 +2736,8 @@ static PyObject *charmapencode_lookup(Py_UNICODE c, PyObject *mapping) } else return NULL; } + else if (x == Py_None) + return x; else if (PyInt_Check(x)) { long value = PyInt_AS_LONG(x); if (value < 0 || value > 255) {