]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport the bits of Guido's fix for
authorMichael W. Hudson <mwh@python.net>
Tue, 5 Mar 2002 15:41:40 +0000 (15:41 +0000)
committerMichael W. Hudson <mwh@python.net>
Tue, 5 Mar 2002 15:41:40 +0000 (15:41 +0000)
SF patch 514641 (Naofumi Honda) - Negative ob_size of LongObjects

that Tim didn't later back out.

Objects/object.c

index 0541fbda44fec5ae1c70bc280cca85df0a452bbb..bcc129cd5c89cf4799141343a3722c3a537e9fa9 100644 (file)
@@ -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);