|
Line
Link Here
|
| 0 |
-- Modules/main.c |
0 |
++ Modules/main.c |
|
Lines 452-458
Link Here
|
| 452 |
filename = argv[_PyOS_optind]; |
452 |
filename = argv[_PyOS_optind]; |
| 453 |
|
453 |
|
| 454 |
#else |
454 |
#else |
| 455 |
filename = argv[_PyOS_optind]; |
455 |
char *target_script_name = getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH"); |
|
|
456 |
if (target_script_name) |
| 457 |
filename = target_script_name; |
| 458 |
else |
| 459 |
filename = argv[_PyOS_optind]; |
| 456 |
#endif |
460 |
#endif |
| 457 |
} |
461 |
} |
| 458 |
|
462 |
|
| 459 |
-- Modules/python.c |
463 |
++ Modules/python.c |
|
Lines 6-14
Link Here
|
| 6 |
#include <floatingpoint.h> |
6 |
#include <floatingpoint.h> |
| 7 |
#endif |
7 |
#endif |
| 8 |
|
8 |
|
|
|
9 |
#ifdef __linux__ |
| 10 |
#include <linux/prctl.h> |
| 11 |
#include <sys/prctl.h> |
| 12 |
#endif |
| 13 |
|
| 9 |
int |
14 |
int |
| 10 |
main(int argc, char **argv) |
15 |
main(int argc, char **argv) |
| 11 |
{ |
16 |
{ |
|
|
17 |
if (getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION")) { |
| 18 |
printf("GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n"); |
| 19 |
return 0; |
| 20 |
} |
| 21 |
|
| 12 |
/* 754 requires that FP exceptions run in "no stop" mode by default, |
22 |
/* 754 requires that FP exceptions run in "no stop" mode by default, |
| 13 |
* and until C vendors implement C99's ways to control FP exceptions, |
23 |
* and until C vendors implement C99's ways to control FP exceptions, |
| 14 |
* Python requires non-stop mode. Alas, some platforms enable FP |
24 |
* Python requires non-stop mode. Alas, some platforms enable FP |
|
Lines 20-24
Link Here
|
| 20 |
m = fpgetmask(); |
30 |
m = fpgetmask(); |
| 21 |
fpsetmask(m & ~FP_X_OFL); |
31 |
fpsetmask(m & ~FP_X_OFL); |
| 22 |
#endif |
32 |
#endif |
|
|
33 |
|
| 34 |
#ifdef __linux__ |
| 35 |
char *process_name = getenv("GENTOO_PYTHON_PROCESS_NAME"); |
| 36 |
if (process_name) |
| 37 |
prctl(PR_SET_NAME, process_name); |
| 38 |
#endif |
| 39 |
|
| 23 |
return Py_Main(argc, argv); |
40 |
return Py_Main(argc, argv); |
| 24 |
} |
41 |
} |
| 25 |
-- Python/sysmodule.c |
42 |
++ Python/sysmodule.c |
|
Lines 1490-1495
Link Here
|
| 1490 |
makeargvobject(int argc, char **argv) |
1490 |
makeargvobject(int argc, char **argv) |
| 1491 |
{ |
1491 |
{ |
| 1492 |
PyObject *av; |
1492 |
PyObject *av; |
|
|
1493 |
char *wrapper_script_name = getenv("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"); |
| 1493 |
if (argc <= 0 || argv == NULL) { |
1494 |
if (argc <= 0 || argv == NULL) { |
| 1494 |
/* Ensure at least one (empty) argument is seen */ |
1495 |
/* Ensure at least one (empty) argument is seen */ |
| 1495 |
static char *empty_argv[1] = {""}; |
1496 |
static char *empty_argv[1] = {""}; |
|
Lines 1514-1520
Link Here
|
| 1514 |
} else |
1515 |
} else |
| 1515 |
v = PyString_FromString(argv[i]); |
1516 |
v = PyString_FromString(argv[i]); |
| 1516 |
#else |
1517 |
#else |
| 1517 |
PyObject *v = PyString_FromString(argv[i]); |
1518 |
PyObject *v; |
|
|
1519 |
if (i == 0 && wrapper_script_name != NULL) |
| 1520 |
v = PyString_FromString(wrapper_script_name); |
| 1521 |
else |
| 1522 |
v = PyString_FromString(argv[i]); |
| 1518 |
#endif |
1523 |
#endif |
| 1519 |
if (v == NULL) { |
1524 |
if (v == NULL) { |
| 1520 |
Py_DECREF(av); |
1525 |
Py_DECREF(av); |