--- Modules/python.c +++ Modules/python.c @@ -2,6 +2,13 @@ #include "Python.h" +#include + +#ifdef __linux__ +#include +#include +#endif + #ifdef __FreeBSD__ #include #endif @@ -9,6 +16,8 @@ int main(int argc, char **argv) { + char *process_name; + /* 754 requires that FP exceptions run in "no stop" mode by default, * and until C vendors implement C99's ways to control FP exceptions, * Python requires non-stop mode. Alas, some platforms enable FP @@ -20,5 +29,12 @@ m = fpgetmask(); fpsetmask(m & ~FP_X_OFL); #endif + +#ifdef __linux__ + if ((process_name = getenv("PYTHON_PROCESS_NAME"))) { + prctl(PR_SET_NAME, process_name); + } +#endif + return Py_Main(argc, argv); }