From: Michael W. Hudson Date: Tue, 5 Mar 2002 15:41:40 +0000 (+0000) Subject: Backport the bits of Guido's fix for X-Git-Tag: v2.2.1c1~111 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c4562a89ea7ad46d6b7ab57481e4cf214e7a7b47;p=thirdparty%2FPython%2Fcpython.git Backport the bits of Guido's fix for SF patch 514641 (Naofumi Honda) - Negative ob_size of LongObjects that Tim didn't later back out. --- diff --git a/Objects/object.c b/Objects/object.c index 0541fbda44fe..bcc129cd5c89 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1191,8 +1191,14 @@ _PyObject_GetDictPtr(PyObject *obj) if (dictoffset == 0) return NULL; if (dictoffset < 0) { - const size_t size = _PyObject_VAR_SIZE(tp, - ((PyVarObject *)obj)->ob_size); + int tsize; + size_t size; + + tsize = ((PyVarObject *)obj)->ob_size; + if (tsize < 0) + tsize = -tsize; + size = _PyObject_VAR_SIZE(tp, tsize); + dictoffset += (long)size; assert(dictoffset > 0); assert(dictoffset % SIZEOF_VOID_P == 0);