summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-03-05 15:41:40 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-03-05 15:41:40 (GMT)
commitc4562a89ea7ad46d6b7ab57481e4cf214e7a7b47 (patch)
tree1f4546be4887138b5c713a4f629f9736f7ee1620
parentd7894ba15806f5053b6a9aba1a5a50630ee52215 (diff)
downloadcpython-c4562a89ea7ad46d6b7ab57481e4cf214e7a7b47.zip
cpython-c4562a89ea7ad46d6b7ab57481e4cf214e7a7b47.tar.gz
cpython-c4562a89ea7ad46d6b7ab57481e4cf214e7a7b47.tar.bz2
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.
-rw-r--r--Objects/object.c10
1 files 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);