From c4562a89ea7ad46d6b7ab57481e4cf214e7a7b47 Mon Sep 17 00:00:00 2001 From: "Michael W. Hudson" Date: Tue, 5 Mar 2002 15:41:40 +0000 Subject: 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. --- Objects/object.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Objects/object.c b/Objects/object.c index 0541fbd..bcc129c 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); -- cgit v0.12