summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-01-08 22:01:33 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-01-08 22:01:33 (GMT)
commitadc727490b521b1de27088b160382396d7b52a8a (patch)
tree8f5c03cf94465351133023a0e3b5dfe6c7f85895 /Objects/unicodeobject.c
parent6757c1e8565262cdc234de3370c4747927a72f72 (diff)
downloadcpython-adc727490b521b1de27088b160382396d7b52a8a.zip
cpython-adc727490b521b1de27088b160382396d7b52a8a.tar.gz
cpython-adc727490b521b1de27088b160382396d7b52a8a.tar.bz2
Fix charmapencode_lookup(), so that a None value in the mapping
is treated as "character maps to <undefined>" and not as "character mapping must return integer, None or str".
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 1e4907a..07579aa 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) {