summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 5812178..8babf79 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);