summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-08-01 01:06:32 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-08-01 01:06:32 (GMT)
commit7888d0803d50fc3716839d0608bdf350cc0e3df4 (patch)
tree049e70de5450e438a38bb3520d2c8dcb82dae3b5 /Objects
parente2e36ba69600bf01ab43a003f788dbfab6e27cd1 (diff)
downloadcpython-7888d0803d50fc3716839d0608bdf350cc0e3df4.zip
cpython-7888d0803d50fc3716839d0608bdf350cc0e3df4.tar.gz
cpython-7888d0803d50fc3716839d0608bdf350cc0e3df4.tar.bz2
Merged revisions 65339-65340,65342 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65339 | amaury.forgeotdarc | 2008-07-31 23:28:03 +0200 (jeu., 31 juil. 2008) | 5 lines #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?) ........ r65340 | amaury.forgeotdarc | 2008-07-31 23:35:03 +0200 (jeu., 31 juil. 2008) | 2 lines Remove a dummy test that was checked in by mistake ........ r65342 | amaury.forgeotdarc | 2008-08-01 01:39:05 +0200 (ven., 01 août 2008) | 8 lines Correct a crash when two successive unicode allocations fail with a MemoryError: the freelist contained half-initialized objects with freed pointers. The comment /* XXX UNREF/NEWREF interface should be more symmetrical */ was copied from tupleobject.c, and appears in some other places. I sign the petition. ........
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 838f537..5925f80 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -322,7 +322,7 @@ PyUnicodeObject *_PyUnicode_New(Py_ssize_t length)
if ((unicode->length < length) &&
unicode_resize(unicode, length) < 0) {
PyObject_DEL(unicode->str);
- goto onError;
+ unicode->str = NULL;
}
}
else {
@@ -360,6 +360,8 @@ PyUnicodeObject *_PyUnicode_New(Py_ssize_t length)
return unicode;
onError:
+ /* XXX UNREF/NEWREF interface should be more symmetrical */
+ _Py_DEC_REFTOTAL;
_Py_ForgetReference((PyObject *)unicode);
PyObject_Del(unicode);
return NULL;