cpython/Modules/getpath_noop.c
Miss Islington (bot) 405519e2a7
[3.15] gh-157142: Fix linking _freeze_module with built-in test modules (GH-157143) (GH-157148)
Programs/_freeze_module is linked with Modules/getpath_noop.o rather than
Modules/getpath.o, and getpath_noop.c only defined _PyConfig_InitPathConfig().
With MODULE_BUILDTYPE=static (the default on wasm), _testinternalcapi.o is
part of LIBRARY_OBJS_OMIT_FROZEN and its get_getpath_codeobject() left
_Py_Get_Getpath_CodeObject() as an undefined reference. Define a stub for it.
(cherry picked from commit c8da735f4f)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-10-10 13:33:29 +03:00

21 lines
674 B
C

/* Implements the getpath API for compiling with no functionality */
#include "Python.h"
#include "pycore_initconfig.h" // _Py_Get_Getpath_CodeObject()
#include "pycore_pathconfig.h" // _PyConfig_InitPathConfig()
PyStatus
_PyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
{
return PyStatus_Error("path configuration is unsupported");
}
/* Used by _testinternalcapi, which is linked into Programs/_freeze_module
when extension modules are built in (MODULE_BUILDTYPE=static). */
PyObject *
_Py_Get_Getpath_CodeObject(void)
{
PyErr_SetString(PyExc_RuntimeError,
"path configuration is unsupported");
return NULL;
}