port: add MSVC600 CPython compatibility layer
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/* Focused compile smoke test for the VC6 C89-mixed-declarations fixes in
|
||||
* four Include/internal/pycore_*.h headers: pycore_code.h, pycore_dict.h,
|
||||
* pycore_list.h, and pycore_call.h.
|
||||
*
|
||||
* VC6 is a C89-only compiler (plus Microsoft extensions): block-scope
|
||||
* declarations must precede all statements in that block. CPython 3.11's
|
||||
* source freely uses C99-style declarations after statements (e.g. after
|
||||
* an assert()); the fix hoists each such declaration to the top of its
|
||||
* enclosing block without changing evaluation order or behavior. See
|
||||
* PORT_STATUS.md ("Mixed-declarations header slice") for full detail.
|
||||
*
|
||||
* Unlike scripts/fixtures/vc6_atomic_smoke.c and vc6_stdbool_smoke.c, this
|
||||
* fixture includes the real "Python.h" (Py_BUILD_CORE is supplied by the
|
||||
* probe script) rather than isolating the pycore_*.h headers from it:
|
||||
* these four headers assume types (PyObject, PyCodeObject, PyListObject,
|
||||
* PyDictValues, vectorcallfunc, ...) that come from the normal public
|
||||
* header chain, the same way real CPython .c sources reach them.
|
||||
*/
|
||||
#include "Python.h"
|
||||
#include "pycore_code.h"
|
||||
#include "pycore_dict.h"
|
||||
#include "pycore_list.h"
|
||||
#include "pycore_call.h"
|
||||
|
||||
int
|
||||
vc6_locals_kind_smoke(PyObject *kinds, int i, _PyLocals_Kind kind)
|
||||
{
|
||||
_PyLocals_SetKind(kinds, i, kind);
|
||||
return (int)_PyLocals_GetKind(kinds, i);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
vc6_adaptive_counter_smoke(uint16_t counter)
|
||||
{
|
||||
return adaptive_counter_backoff(counter);
|
||||
}
|
||||
|
||||
void
|
||||
vc6_dict_values_smoke(PyDictValues *values, Py_ssize_t ix)
|
||||
{
|
||||
_PyDictValues_AddToInsertionOrder(values, ix);
|
||||
}
|
||||
|
||||
int
|
||||
vc6_list_append_smoke(PyListObject *self, PyObject *newitem)
|
||||
{
|
||||
return _PyList_AppendTakeRef(self, newitem);
|
||||
}
|
||||
|
||||
vectorcallfunc
|
||||
vc6_vectorcall_smoke(PyObject *callable)
|
||||
{
|
||||
return _PyVectorcall_FunctionInline(callable);
|
||||
}
|
||||
Reference in New Issue
Block a user