From 37bddd8e77198c6c2fe09f098b9af9cd7b4b8711 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Thu, 29 Aug 2024 19:40:34 -0400 Subject: [PATCH] Fix the debug offsets for PyLongObject All other debug offsets are relative to the start of the object, but the offsets for PyLongObject's fields are relative to the start of an inner object, and so each field's value is too small by `sizeof(PyObject)`. Signed-off-by: Matt Wozniski --- Include/internal/pycore_runtime_init.h | 4 ++-- .../2024-08-29-19-46-07.gh-issue-123484.rjUn_F.rst | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2024-08-29-19-46-07.gh-issue-123484.rjUn_F.rst diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h index 1746bbf0eec8b5..e6adb98eb19130 100644 --- a/Include/internal/pycore_runtime_init.h +++ b/Include/internal/pycore_runtime_init.h @@ -117,8 +117,8 @@ extern PyTypeObject _PyExc_MemoryError; }, \ .long_object = { \ .size = sizeof(PyLongObject), \ - .lv_tag = offsetof(_PyLongValue, lv_tag), \ - .ob_digit = offsetof(_PyLongValue, ob_digit), \ + .lv_tag = offsetof(PyLongObject, long_value.lv_tag), \ + .ob_digit = offsetof(PyLongObject, long_value.ob_digit), \ }, \ .bytes_object = { \ .size = sizeof(PyBytesObject), \ diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-08-29-19-46-07.gh-issue-123484.rjUn_F.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-08-29-19-46-07.gh-issue-123484.rjUn_F.rst new file mode 100644 index 00000000000000..3062e3684c8e78 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-08-29-19-46-07.gh-issue-123484.rjUn_F.rst @@ -0,0 +1,2 @@ +Fix ``_Py_DebugOffsets`` for long objects to be relative to the start of the +object rather than the start of a subobject.