port: advance MSVC600 CPython compatibility frontier

This commit is contained in:
RayPals
2026-08-22 17:36:38 +00:00
parent a7a9560e5c
commit 824b4f0d24
15 changed files with 6150 additions and 41 deletions
+19 -8
View File
@@ -7,15 +7,16 @@
* three distinct patterns:
*
* 1. `status = _PyStatus_OK();` -- a compound-literal macro used as a
* plain assignment's right-hand side. Fixed by calling the existing
* public API function PyStatus_Ok() instead, which
* Python/initconfig.c defines as `return _PyStatus_OK();` -- the
* identical value, no header change needed.
* 2. `cf = _PyCompilerFlags_INIT;` -- likewise a compound-literal macro
* plain assignment's right-hand side. The shared macro now expands to
* a VC6-only internal helper that assigns PyStatus fields explicitly,
* while newer compilers keep the original compound-literal form.
* 2. `status = _PyStatus_ERR("...");` -- same compound-literal macro
* pattern for ERROR statuses, now using a VC6-only explicit helper.
* 3. `cf = _PyCompilerFlags_INIT;` -- likewise a compound-literal macro
* used as a plain assignment. Fixed by assigning PyCompilerFlags's
* two fields explicitly (cf_flags, cf_feature_version), matching the
* macro's own definition field-for-field.
* 3. `_PyArgv args = { .argc = argc, ... };` -- a designated-initializer
* 4. `_PyArgv args = { .argc = argc, ... };` -- a designated-initializer
* aggregate initializer with no macro involved. Fixed by declaring
* the variable bare and assigning each field explicitly; field order
* does not matter for plain assignment, unlike an initializer list.
@@ -35,8 +36,18 @@ vc6_status_ok_smoke(void)
{
PyStatus status;
/* pattern 1: was `status = _PyStatus_OK();` */
status = PyStatus_Ok();
/* pattern 1: VC6-only _PyStatus_OK() macro fallback helper. */
status = _PyStatus_OK();
return status;
}
PyStatus
vc6_status_error_smoke(void)
{
PyStatus status;
/* pattern 2: VC6-only _PyStatus_ERR() macro fallback helper. */
status = _PyStatus_ERR("vc6 status error smoke");
return status;
}