port: advance VC6 typeobject frontier and preserve regression coverage

This commit is contained in:
RayPals
2026-10-26 18:09:33 +00:00
parent 35caf1a558
commit 5ab291a68c
162 changed files with 15675 additions and 85 deletions
+32
View File
@@ -51,3 +51,35 @@ text = check("PyObject_Repr", (
), "PyObject_Repr must hoist tstate while preserving signal-check order")
assert "PyThreadState *tstate =" not in text
print("object PyObject_Repr C89 local and signal-check order: PASS")
text = body("_PyObject_DictPointer")
expected = '''
Py_ssize_t dictoffset;
PyTypeObject *tp = Py_TYPE(obj);
if (tp->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
return _PyObject_ManagedDictPointer(obj);
}
dictoffset = tp->tp_dictoffset;
if (dictoffset == 0)
return NULL;
if (dictoffset < 0) {
Py_ssize_t tsize = Py_SIZE(obj);
size_t size;
if (tsize < 0) {
tsize = -tsize;
}
size = _PyObject_VAR_SIZE(tp, tsize);
assert(size <= (size_t)PY_SSIZE_T_MAX);
dictoffset += (Py_ssize_t)size;
_PyObject_ASSERT(obj, dictoffset > 0);
_PyObject_ASSERT(obj, dictoffset % SIZEOF_VOID_P == 0);
}
return (PyObject **) ((char *)obj + dictoffset);
'''
assert text.split() == expected.split(), (
"_PyObject_DictPointer must hoist only size to the block's opening declarations "
"and preserve the size expression and statement order"
)
print("object _PyObject_DictPointer C89 size declaration and offset calculation order: PASS")