Skip to content

Commit

Permalink
pythongh-116417: Fix WASI build of _testlimitedcapi (python#116974)
Browse files Browse the repository at this point in the history
Use different function names between _testcapi and _testlimitedcapi
to not confuse the WASI linker.
  • Loading branch information
vstinner authored and adorilson committed Mar 25, 2024
1 parent d2cc307 commit e56234d
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 24 deletions.
16 changes: 8 additions & 8 deletions Modules/_testlimitedcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ PyInit__testlimitedcapi(void)
return NULL;
}

if (_PyTestCapi_Init_ByteArray(mod) < 0) {
if (_PyTestLimitedCAPI_Init_ByteArray(mod) < 0) {
return NULL;
}
if (_PyTestCapi_Init_Bytes(mod) < 0) {
if (_PyTestLimitedCAPI_Init_Bytes(mod) < 0) {
return NULL;
}
if (_PyTestCapi_Init_HeaptypeRelative(mod) < 0) {
if (_PyTestLimitedCAPI_Init_HeaptypeRelative(mod) < 0) {
return NULL;
}
if (_PyTestCapi_Init_List(mod) < 0) {
if (_PyTestLimitedCAPI_Init_List(mod) < 0) {
return NULL;
}
if (_PyTestCapi_Init_PyOS(mod) < 0) {
if (_PyTestLimitedCAPI_Init_PyOS(mod) < 0) {
return NULL;
}
if (_PyTestCapi_Init_Set(mod) < 0) {
if (_PyTestLimitedCAPI_Init_Set(mod) < 0) {
return NULL;
}
if (_PyTestCapi_Init_Sys(mod) < 0) {
if (_PyTestLimitedCAPI_Init_Sys(mod) < 0) {
return NULL;
}
if (_PyTestCapi_Init_VectorcallLimited(mod) < 0) {
if (_PyTestLimitedCAPI_Init_VectorcallLimited(mod) < 0) {
return NULL;
}
return mod;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_testlimitedcapi/bytearray.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static PyMethodDef test_methods[] = {
};

int
_PyTestCapi_Init_ByteArray(PyObject *m)
_PyTestLimitedCAPI_Init_ByteArray(PyObject *m)
{
if (PyModule_AddFunctions(m, test_methods) < 0) {
return -1;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_testlimitedcapi/bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static PyMethodDef test_methods[] = {
};

int
_PyTestCapi_Init_Bytes(PyObject *m)
_PyTestLimitedCAPI_Init_Bytes(PyObject *m)
{
if (PyModule_AddFunctions(m, test_methods) < 0) {
return -1;
Expand Down
3 changes: 2 additions & 1 deletion Modules/_testlimitedcapi/heaptype_relative.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ static PyMethodDef TestMethods[] = {
};

int
_PyTestCapi_Init_HeaptypeRelative(PyObject *m) {
_PyTestLimitedCAPI_Init_HeaptypeRelative(PyObject *m)
{
if (PyModule_AddFunctions(m, TestMethods) < 0) {
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/_testlimitedcapi/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static PyMethodDef test_methods[] = {
};

int
_PyTestCapi_Init_List(PyObject *m)
_PyTestLimitedCAPI_Init_List(PyObject *m)
{
if (PyModule_AddFunctions(m, test_methods) < 0) {
return -1;
Expand Down
16 changes: 8 additions & 8 deletions Modules/_testlimitedcapi/parts.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
# error "Py_BUILD_CORE macro must not be defined"
#endif

int _PyTestCapi_Init_ByteArray(PyObject *module);
int _PyTestCapi_Init_Bytes(PyObject *module);
int _PyTestCapi_Init_HeaptypeRelative(PyObject *module);
int _PyTestCapi_Init_List(PyObject *module);
int _PyTestCapi_Init_PyOS(PyObject *module);
int _PyTestCapi_Init_Set(PyObject *module);
int _PyTestCapi_Init_Sys(PyObject *module);
int _PyTestCapi_Init_VectorcallLimited(PyObject *module);
int _PyTestLimitedCAPI_Init_ByteArray(PyObject *module);
int _PyTestLimitedCAPI_Init_Bytes(PyObject *module);
int _PyTestLimitedCAPI_Init_HeaptypeRelative(PyObject *module);
int _PyTestLimitedCAPI_Init_List(PyObject *module);
int _PyTestLimitedCAPI_Init_PyOS(PyObject *module);
int _PyTestLimitedCAPI_Init_Set(PyObject *module);
int _PyTestLimitedCAPI_Init_Sys(PyObject *module);
int _PyTestLimitedCAPI_Init_VectorcallLimited(PyObject *module);

#endif // Py_TESTLIMITEDCAPI_PARTS_H
2 changes: 1 addition & 1 deletion Modules/_testlimitedcapi/pyos.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static PyMethodDef test_methods[] = {
};

int
_PyTestCapi_Init_PyOS(PyObject *mod)
_PyTestLimitedCAPI_Init_PyOS(PyObject *mod)
{
if (PyModule_AddFunctions(mod, test_methods) < 0) {
return -1;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_testlimitedcapi/set.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static PyMethodDef test_methods[] = {
};

int
_PyTestCapi_Init_Set(PyObject *m)
_PyTestLimitedCAPI_Init_Set(PyObject *m)
{
if (PyModule_AddFunctions(m, test_methods) < 0) {
return -1;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_testlimitedcapi/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static PyMethodDef test_methods[] = {
};

int
_PyTestCapi_Init_Sys(PyObject *m)
_PyTestLimitedCAPI_Init_Sys(PyObject *m)
{
if (PyModule_AddFunctions(m, test_methods) < 0) {
return -1;
Expand Down
3 changes: 2 additions & 1 deletion Modules/_testlimitedcapi/vectorcall_limited.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ static PyMethodDef TestMethods[] = {
};

int
_PyTestCapi_Init_VectorcallLimited(PyObject *m) {
_PyTestLimitedCAPI_Init_VectorcallLimited(PyObject *m)
{
if (PyModule_AddFunctions(m, TestMethods) < 0) {
return -1;
}
Expand Down

0 comments on commit e56234d

Please sign in to comment.