--- py3k/Objects/setobject.c 2010-04-19 01:27:35.000000000 +0400 +++ py3k/Objects/setobject.c 2010-04-19 03:03:26.000000000 +0400 @@ -605,15 +605,17 @@ goto done; newsize = PyUnicode_GET_SIZE(listrepr); result = PyUnicode_FromUnicode(NULL, newsize); - if (result) { - u = PyUnicode_AS_UNICODE(result); - *u++ = '{'; - /* Omit the brackets from the listrepr */ - Py_UNICODE_COPY(u, PyUnicode_AS_UNICODE(listrepr)+1, - PyUnicode_GET_SIZE(listrepr)-2); - u += newsize-2; - *u++ = '}'; + if (result == NULL) { + Py_DECREF(listrepr); + goto done; } + u = PyUnicode_AS_UNICODE(result); + *u++ = '{'; + /* Omit the brackets from the listrepr */ + Py_UNICODE_COPY(u, PyUnicode_AS_UNICODE(listrepr)+1, + PyUnicode_GET_SIZE(listrepr)-2); + u += newsize-2; + *u++ = '}'; Py_DECREF(listrepr); if (Py_TYPE(so) != &PySet_Type) { PyObject *tmp = PyUnicode_FromFormat("%s(%U)",