mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-99845: _PyObject_DictPointer(): fix dictoffset cast (GH-99922)
Cast size_t to Py_ssize_t, rather than casting it to long. On 64-bit
Windows, long is 32-bit whereas Py_ssize_t is 64-bit.
(cherry picked from commit 9707bf228e
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
807b103bdd
commit
64dae2efd5
1 changed files with 2 additions and 1 deletions
|
@ -1091,8 +1091,9 @@ _PyObject_GetDictPtr(PyObject *obj)
|
|||
tsize = -tsize;
|
||||
}
|
||||
size_t size = _PyObject_VAR_SIZE(tp, tsize);
|
||||
assert(size <= (size_t)PY_SSIZE_T_MAX);
|
||||
dictoffset += (Py_ssize_t)size;
|
||||
|
||||
dictoffset += (long)size;
|
||||
_PyObject_ASSERT(obj, dictoffset > 0);
|
||||
_PyObject_ASSERT(obj, dictoffset % SIZEOF_VOID_P == 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue