diff options
author | Marc-André Lemburg <mal@egenix.com> | 2003-02-04 19:35:03 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2003-02-04 19:35:03 (GMT) |
commit | 29273c87da0ef361f84fee41385f7c991536f9cd (patch) | |
tree | 651170a5da2d5037eb72445a91d3132c94bd083a /Modules/_codecsmodule.c | |
parent | 604ade4ebd258300776009fa462eb23ea4a24e2e (diff) | |
download | cpython-29273c87da0ef361f84fee41385f7c991536f9cd.zip cpython-29273c87da0ef361f84fee41385f7c991536f9cd.tar.gz cpython-29273c87da0ef361f84fee41385f7c991536f9cd.tar.bz2 |
Fix for [ 543344 ] Interpreter crashes when recoding; suggested
by Michael Stone (mbrierst).
Python 2.1.4, 2.2.2 candidate.
Diffstat (limited to 'Modules/_codecsmodule.c')
-rw-r--r-- | Modules/_codecsmodule.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c index cd19ab5..210be51 100644 --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -167,8 +167,10 @@ unicode_internal_decode(PyObject *self, &obj, &errors)) return NULL; - if (PyUnicode_Check(obj)) + if (PyUnicode_Check(obj)) { + Py_INCREF(obj); return codec_tuple(obj, PyUnicode_GET_SIZE(obj)); + } else { if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) return NULL; |