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
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""Guard _PyTypes_InitState's C89 declaration and initialization order."""
import re
import sys
from pathlib import Path
source = Path(sys.argv[1]).read_text()
found = re.search(
r"\n_PyTypes_InitState\(PyInterpreterState \*interp\)\s*\{(?P<body>.*?)\n\}",
source,
re.S,
)
assert found, "_PyTypes_InitState definition not found"
body = found.group("body")
declaration = re.match(r"\s*PyStatus status;", body)
assert declaration and len(re.findall(r"\bPyStatus\s+status\b", body)) == 1, (
"_PyTypes_InitState must declare status exactly once without initializer at entry"
)
expected_statements = '''
if (!_Py_IsMainInterpreter(interp)) {
return _PyStatus_OK();
}
status = _PyTypes_InitSlotDefs();
if (_PyStatus_EXCEPTION(status)) {
return status;
}
return _PyStatus_OK();
'''
assert body[declaration.end():].split() == expected_statements.split(), (
"_PyTypes_InitState must preserve the interpreter guard, slot initialization, "
"exception propagation, and success return order"
)
print("object _PyTypes_InitState C89 status declaration and initialization/return order: PASS")