| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 46972b7 commit f04ebe2
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,6 +64,8 @@ typedef struct { | |||
| 64 | 64 | wchar_t *module_search_path_env; | |
| 65 | 65 | /* PYTHONHOME environment variable, see also Py_SetPythonHome(). */ | |
| 66 | 66 | wchar_t *home; | |
| 67 | + /* Program name, see also Py_GetProgramName() */ | ||
| 68 | + wchar_t *program_name; | ||
| 67 | 69 | } _PyMainInterpreterConfig; | |
| 68 | 70 | ||
| 69 | 71 | #define _PyMainInterpreterConfig_INIT \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,7 +112,7 @@ extern "C" { | |||
| 112 | 112 | typedef struct { | |
| 113 | 113 | wchar_t prefix[MAXPATHLEN+1]; | |
| 114 | 114 | wchar_t exec_prefix[MAXPATHLEN+1]; | |
| 115 | - wchar_t progpath[MAXPATHLEN+1]; | ||
| 115 | + wchar_t program_name[MAXPATHLEN+1]; | ||
| 116 | 116 | wchar_t *module_search_path; | |
| 117 | 117 | } PyPathConfig; | |
| 118 | 118 | ||
@@ -121,7 +121,7 @@ typedef struct { | |||
| 121 | 121 | wchar_t *home; /* PYTHONHOME environment variable */ | |
| 122 | 122 | wchar_t *module_search_path_env; /* PYTHONPATH environment variable */ | |
| 123 | 123 | ||
| 124 | - wchar_t *prog; /* Program name */ | ||
| 124 | + wchar_t *program_name; /* Program name */ | ||
| 125 | 125 | wchar_t *pythonpath; /* PYTHONPATH define */ | |
| 126 | 126 | wchar_t *prefix; /* PREFIX define */ | |
| 127 | 127 | wchar_t *exec_prefix; /* EXEC_PREFIX define */ | |
@@ -602,8 +602,8 @@ calculate_progpath(PyCalculatePath *calculate, PyPathConfig *config) | |||
| 602 | 602 | * other way to find a directory to start the search from. If | |
| 603 | 603 | * $PATH isn't exported, you lose. | |
| 604 | 604 | */ | |
| 605 | - if (wcschr(calculate->prog, SEP)) { | ||
| 606 | - wcsncpy(config->progpath, calculate->prog, MAXPATHLEN); | ||
| 605 | + if (wcschr(calculate->program_name, SEP)) { | ||
| 606 | + wcsncpy(config->program_name, calculate->program_name, MAXPATHLEN); | ||
| 607 | 607 | } | |
| 608 | 608 | #ifdef __APPLE__ | |
| 609 | 609 | /* On Mac OS X, if a script uses an interpreter of the form | |
@@ -616,11 +616,13 @@ calculate_progpath(PyCalculatePath *calculate, PyPathConfig *config) | |||
| 616 | 616 | * will fail if a relative path was used. but in that case, | |
| 617 | 617 | * absolutize() should help us out below | |
| 618 | 618 | */ | |
| 619 | - else if(0 == _NSGetExecutablePath(execpath, &nsexeclength) && execpath[0] == SEP) { | ||
| 620 | - size_t r = mbstowcs(config->progpath, execpath, MAXPATHLEN+1); | ||
| 619 | + else if(0 == _NSGetExecutablePath(execpath, &nsexeclength) && | ||
| 620 | + execpath[0] == SEP) | ||
| 621 | + { | ||
| 622 | + size_t r = mbstowcs(config->program_name, execpath, MAXPATHLEN+1); | ||
| 621 | 623 | if (r == (size_t)-1 || r > MAXPATHLEN) { | |
| 622 | 624 | /* Could not convert execpath, or it's too long. */ | |
| 623 | - config->progpath[0] = '\0'; | ||
| 625 | + config->program_name[0] = '\0'; | ||
| 624 | 626 | } | |
| 625 | 627 | } | |
| 626 | 628 | #endif /* __APPLE__ */ | |
@@ -634,38 +636,38 @@ calculate_progpath(PyCalculatePath *calculate, PyPathConfig *config) | |||
| 634 | 636 | if (len > MAXPATHLEN) { | |
| 635 | 637 | len = MAXPATHLEN; | |
| 636 | 638 | } | |
| 637 | - wcsncpy(config->progpath, path, len); | ||
| 638 | - *(config->progpath + len) = '\0'; | ||
| 639 | + wcsncpy(config->program_name, path, len); | ||
| 640 | + *(config->program_name + len) = '\0'; | ||
| 639 | 641 | } | |
| 640 | 642 | else { | |
| 641 | - wcsncpy(config->progpath, path, MAXPATHLEN); | ||
| 643 | + wcsncpy(config->program_name, path, MAXPATHLEN); | ||
| 642 | 644 | } | |
| 643 | 645 | ||
| 644 | - joinpath(config->progpath, calculate->prog); | ||
| 645 | - if (isxfile(config->progpath)) { | ||
| 646 | + joinpath(config->program_name, calculate->program_name); | ||
| 647 | + if (isxfile(config->program_name)) { | ||
| 646 | 648 | break; | |
| 647 | 649 | } | |
| 648 | 650 | ||
| 649 | 651 | if (!delim) { | |
| 650 | - config->progpath[0] = L'\0'; | ||
| 652 | + config->program_name[0] = L'\0'; | ||
| 651 | 653 | break; | |
| 652 | 654 | } | |
| 653 | 655 | path = delim + 1; | |
| 654 | 656 | } | |
| 655 | 657 | } | |
| 656 | 658 | else { | |
| 657 | - config->progpath[0] = '\0'; | ||
| 659 | + config->program_name[0] = '\0'; | ||
| 658 | 660 | } | |
| 659 | - if (config->progpath[0] != SEP && config->progpath[0] != '\0') { | ||
| 660 | - absolutize(config->progpath); | ||
| 661 | + if (config->program_name[0] != SEP && config->program_name[0] != '\0') { | ||
| 662 | + absolutize(config->program_name); | ||
| 661 | 663 | } | |
| 662 | 664 | } | |
| 663 | 665 | ||
| 664 | 666 | ||
| 665 | 667 | static void | |
| 666 | 668 | calculate_argv0_path(PyCalculatePath *calculate, PyPathConfig *config) | |
| 667 | 669 | { | |
| 668 | - wcsncpy(calculate->argv0_path, config->progpath, MAXPATHLEN); | ||
| 670 | + wcsncpy(calculate->argv0_path, config->program_name, MAXPATHLEN); | ||
| 669 | 671 | calculate->argv0_path[MAXPATHLEN] = '\0'; | |
| 670 | 672 | ||
| 671 | 673 | #ifdef WITH_NEXT_FRAMEWORK | |
@@ -700,10 +702,10 @@ calculate_argv0_path(PyCalculatePath *calculate, PyPathConfig *config) | |||
| 700 | 702 | if (!ismodule(calculate->argv0_path)) { | |
| 701 | 703 | /* We are in the build directory so use the name of the | |
| 702 | 704 | executable - we know that the absolute path is passed */ | |
| 703 | - wcsncpy(calculate->argv0_path, config->progpath, MAXPATHLEN); | ||
| 705 | + wcsncpy(calculate->argv0_path, config->program_name, MAXPATHLEN); | ||
| 704 | 706 | } | |
| 705 | 707 | else { | |
| 706 | - /* Use the location of the library as the progpath */ | ||
| 708 | + /* Use the location of the library as the program_name */ | ||
| 707 | 709 | wcsncpy(calculate->argv0_path, wbuf, MAXPATHLEN); | |
| 708 | 710 | } | |
| 709 | 711 | PyMem_RawFree(wbuf); | |
@@ -712,15 +714,15 @@ calculate_argv0_path(PyCalculatePath *calculate, PyPathConfig *config) | |||
| 712 | 714 | ||
| 713 | 715 | #if HAVE_READLINK | |
| 714 | 716 | wchar_t tmpbuffer[MAXPATHLEN+1]; | |
| 715 | - int linklen = _Py_wreadlink(config->progpath, tmpbuffer, MAXPATHLEN); | ||
| 717 | + int linklen = _Py_wreadlink(config->program_name, tmpbuffer, MAXPATHLEN); | ||
| 716 | 718 | while (linklen != -1) { | |
| 717 | 719 | if (tmpbuffer[0] == SEP) { | |
| 718 | 720 | /* tmpbuffer should never be longer than MAXPATHLEN, | |
| 719 | 721 | but extra check does not hurt */ | |
| 720 | 722 | wcsncpy(calculate->argv0_path, tmpbuffer, MAXPATHLEN); | |
| 721 | 723 | } | |
| 722 | 724 | else { | |
| 723 | - /* Interpret relative to progpath */ | ||
| 725 | + /* Interpret relative to program_name */ | ||
| 724 | 726 | reduce(calculate->argv0_path); | |
| 725 | 727 | joinpath(calculate->argv0_path, tmpbuffer); | |
| 726 | 728 | } | |
@@ -897,6 +899,7 @@ calculate_init(PyCalculatePath *calculate, | |||
| 897 | 899 | { | |
| 898 | 900 | calculate->home = main_config->home; | |
| 899 | 901 | calculate->module_search_path_env = main_config->module_search_path_env; | |
| 902 | + calculate->program_name = main_config->program_name; | ||
| 900 | 903 | ||
| 901 | 904 | size_t len; | |
| 902 | 905 | char *path = getenv("PATH"); | |
@@ -907,8 +910,6 @@ calculate_init(PyCalculatePath *calculate, | |||
| 907 | 910 | } | |
| 908 | 911 | } | |
| 909 | 912 | ||
| 910 | - calculate->prog = Py_GetProgramName(); | ||
| 911 | - | ||
| 912 | 913 | calculate->pythonpath = Py_DecodeLocale(PYTHONPATH, &len); | |
| 913 | 914 | if (!calculate->pythonpath) { | |
| 914 | 915 | return DECODE_LOCALE_ERR("PYTHONPATH define", len); | |
@@ -950,7 +951,9 @@ calculate_path_impl(PyCalculatePath *calculate, PyPathConfig *config) | |||
| 950 | 951 | calculate_zip_path(calculate, config); | |
| 951 | 952 | calculate_exec_prefix(calculate, config); | |
| 952 | 953 | ||
| 953 | - if ((!calculate->prefix_found || !calculate->exec_prefix_found) && !Py_FrozenFlag) { | ||
| 954 | + if ((!calculate->prefix_found || !calculate->exec_prefix_found) && | ||
| 955 | + !Py_FrozenFlag) | ||
| 956 | + { | ||
| 954 | 957 | fprintf(stderr, | |
| 955 | 958 | "Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]\n"); | |
| 956 | 959 | } | |
@@ -1018,10 +1021,11 @@ Py_SetPath(const wchar_t *path) | |||
| 1018 | 1021 | return; | |
| 1019 | 1022 | } | |
| 1020 | 1023 | ||
| 1021 | - wchar_t *prog = Py_GetProgramName(); | ||
| 1022 | - wcsncpy(path_config.progpath, prog, MAXPATHLEN); | ||
| 1024 | + wchar_t *program_name = Py_GetProgramName(); | ||
| 1025 | + wcsncpy(path_config.program_name, program_name, MAXPATHLEN); | ||
| 1023 | 1026 | path_config.exec_prefix[0] = path_config.prefix[0] = L'\0'; | |
| 1024 | - path_config.module_search_path = PyMem_RawMalloc((wcslen(path) + 1) * sizeof(wchar_t)); | ||
| 1027 | + size_t size = (wcslen(path) + 1) * sizeof(wchar_t); | ||
| 1028 | + path_config.module_search_path = PyMem_RawMalloc(size); | ||
| 1025 | 1029 | if (path_config.module_search_path != NULL) { | |
| 1026 | 1030 | wcscpy(path_config.module_search_path, path); | |
| 1027 | 1031 | } | |
@@ -1074,7 +1078,7 @@ Py_GetProgramFullPath(void) | |||
| 1074 | 1078 | if (!path_config.module_search_path) { | |
| 1075 | 1079 | calculate_path(NULL); | |
| 1076 | 1080 | } | |
| 1077 | - return path_config.progpath; | ||
| 1081 | + return path_config.program_name; | ||
| 1078 | 1082 | } | |
| 1079 | 1083 | ||
| 1080 | 1084 | #ifdef __cplusplus | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1452,6 +1452,13 @@ _PyMainInterpreterConfig_ReadEnv(_PyMainInterpreterConfig *config) | |||
| 1452 | 1452 | return err; | |
| 1453 | 1453 | } | |
| 1454 | 1454 | ||
| 1455 | + /* FIXME: _PyMainInterpreterConfig_Read() has the same code. Remove it | ||
| 1456 | + here? See also pymain_get_program_name() and pymain_parse_envvars(). */ | ||
| 1457 | + config->program_name = _PyMem_RawWcsdup(Py_GetProgramName()); | ||
| 1458 | + if (config->program_name == NULL) { | ||
| 1459 | + return _Py_INIT_NO_MEMORY(); | ||
| 1460 | + } | ||
| 1461 | + | ||
| 1455 | 1462 | return _Py_INIT_OK(); | |
| 1456 | 1463 | } | |
| 1457 | 1464 | ||
@@ -1480,6 +1487,15 @@ pymain_parse_envvars(_PyMain *pymain) | |||
| 1480 | 1487 | } | |
| 1481 | 1488 | core_config->allocator = Py_GETENV("PYTHONMALLOC"); | |
| 1482 | 1489 | ||
| 1490 | + /* FIXME: move pymain_get_program_name() code into | ||
| 1491 | + _PyMainInterpreterConfig_ReadEnv(). | ||
| 1492 | + Problem: _PyMainInterpreterConfig_ReadEnv() doesn't have access | ||
| 1493 | + to argv[0]. */ | ||
| 1494 | + Py_SetProgramName(pymain->program_name); | ||
| 1495 | + /* Don't free program_name here: the argument to Py_SetProgramName | ||
| 1496 | + must remain valid until Py_FinalizeEx is called. The string is freed | ||
| 1497 | + by pymain_free(). */ | ||
| 1498 | + | ||
| 1483 | 1499 | _PyInitError err = _PyMainInterpreterConfig_ReadEnv(&pymain->config); | |
| 1484 | 1500 | if (_Py_INIT_FAILED(pymain->err)) { | |
| 1485 | 1501 | pymain->err = err; | |
@@ -1569,11 +1585,6 @@ pymain_init_python(_PyMain *pymain) | |||
| 1569 | 1585 | return -1; | |
| 1570 | 1586 | } | |
| 1571 | 1587 | ||
| 1572 | - Py_SetProgramName(pymain->program_name); | ||
| 1573 | - /* Don't free program_name here: the argument to Py_SetProgramName | ||
| 1574 | - must remain valid until Py_FinalizeEx is called. The string is freed | ||
| 1575 | - by pymain_free(). */ | ||
| 1576 | - | ||
| 1577 | 1588 | if (pymain_add_xoptions(pymain)) { | |
| 1578 | 1589 | return -1; | |
| 1579 | 1590 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,7 +118,7 @@ | |||
| 118 | 118 | ||
| 119 | 119 | typedef struct { | |
| 120 | 120 | wchar_t prefix[MAXPATHLEN+1]; | |
| 121 | - wchar_t progpath[MAXPATHLEN+1]; | ||
| 121 | + wchar_t program_name[MAXPATHLEN+1]; | ||
| 122 | 122 | wchar_t dllpath[MAXPATHLEN+1]; | |
| 123 | 123 | wchar_t *module_search_path; | |
| 124 | 124 | } PyPathConfig; | |
@@ -132,7 +132,7 @@ typedef struct { | |||
| 132 | 132 | wchar_t *machine_path; /* from HKEY_LOCAL_MACHINE */ | |
| 133 | 133 | wchar_t *user_path; /* from HKEY_CURRENT_USER */ | |
| 134 | 134 | ||
| 135 | - wchar_t *prog; /* Program name */ | ||
| 135 | + wchar_t *program_name; /* Program name */ | ||
| 136 | 136 | wchar_t argv0_path[MAXPATHLEN+1]; | |
| 137 | 137 | wchar_t zip_path[MAXPATHLEN+1]; | |
| 138 | 138 | } PyCalculatePath; | |
@@ -484,22 +484,22 @@ getpythonregpath(HKEY keyBase, int skipcore) | |||
| 484 | 484 | ||
| 485 | 485 | ||
| 486 | 486 | static void | |
| 487 | - get_progpath(PyCalculatePath *calculate, wchar_t *progpath, wchar_t *dllpath) | ||
| 487 | + get_progpath(PyCalculatePath *calculate, PyPathConfig *config) | ||
| 488 | 488 | { | |
| 489 | 489 | wchar_t *path = calculate->path_env; | |
| 490 | 490 | ||
| 491 | 491 | #ifdef Py_ENABLE_SHARED | |
| 492 | 492 | extern HANDLE PyWin_DLLhModule; | |
| 493 | - /* static init of progpath ensures final char remains \0 */ | ||
| 493 | + /* static init of program_name ensures final char remains \0 */ | ||
| 494 | 494 | if (PyWin_DLLhModule) { | |
| 495 | - if (!GetModuleFileNameW(PyWin_DLLhModule, dllpath, MAXPATHLEN)) { | ||
| 496 | - dllpath[0] = 0; | ||
| 495 | + if (!GetModuleFileNameW(PyWin_DLLhModule, config->dllpath, MAXPATHLEN)) { | ||
| 496 | + config->dllpath[0] = 0; | ||
| 497 | 497 | } | |
| 498 | 498 | } | |
| 499 | 499 | #else | |
| 500 | - dllpath[0] = 0; | ||
| 500 | + config->dllpath[0] = 0; | ||
| 501 | 501 | #endif | |
| 502 | - if (GetModuleFileNameW(NULL, progpath, MAXPATHLEN)) { | ||
| 502 | + if (GetModuleFileNameW(NULL, config->program_name, MAXPATHLEN)) { | ||
| 503 | 503 | return; | |
| 504 | 504 | } | |
| 505 | 505 | ||
@@ -509,12 +509,12 @@ get_progpath(PyCalculatePath *calculate, wchar_t *progpath, wchar_t *dllpath) | |||
| 509 | 509 | * $PATH isn't exported, you lose. | |
| 510 | 510 | */ | |
| 511 | 511 | #ifdef ALTSEP | |
| 512 | - if (wcschr(calculate->prog, SEP) || wcschr(calculate->prog, ALTSEP)) | ||
| 512 | + if (wcschr(calculate->program_name, SEP) || wcschr(calculate->program_name, ALTSEP)) | ||
| 513 | 513 | #else | |
| 514 | - if (wcschr(calculate->prog, SEP)) | ||
| 514 | + if (wcschr(calculate->program_name, SEP)) | ||
| 515 | 515 | #endif | |
| 516 | 516 | { | |
| 517 | - wcsncpy(progpath, calculate->prog, MAXPATHLEN); | ||
| 517 | + wcsncpy(config->program_name, calculate->program_name, MAXPATHLEN); | ||
| 518 | 518 | } | |
| 519 | 519 | else if (path) { | |
| 520 | 520 | while (1) { | |
@@ -524,28 +524,28 @@ get_progpath(PyCalculatePath *calculate, wchar_t *progpath, wchar_t *dllpath) | |||
| 524 | 524 | size_t len = delim - path; | |
| 525 | 525 | /* ensure we can't overwrite buffer */ | |
| 526 | 526 | len = min(MAXPATHLEN,len); | |
| 527 | - wcsncpy(progpath, path, len); | ||
| 528 | - *(progpath + len) = '\0'; | ||
| 527 | + wcsncpy(config->program_name, path, len); | ||
| 528 | + *(config->program_name + len) = '\0'; | ||
| 529 | 529 | } | |
| 530 | 530 | else { | |
| 531 | - wcsncpy(progpath, path, MAXPATHLEN); | ||
| 531 | + wcsncpy(config->program_name, path, MAXPATHLEN); | ||
| 532 | 532 | } | |
| 533 | 533 | ||
| 534 | 534 | /* join() is safe for MAXPATHLEN+1 size buffer */ | |
| 535 | - join(progpath, calculate->prog); | ||
| 536 | - if (exists(progpath)) { | ||
| 535 | + join(config->program_name, calculate->program_name); | ||
| 536 | + if (exists(config->program_name)) { | ||
| 537 | 537 | break; | |
| 538 | 538 | } | |
| 539 | 539 | ||
| 540 | 540 | if (!delim) { | |
| 541 | - progpath[0] = '\0'; | ||
| 541 | + config->program_name[0] = '\0'; | ||
| 542 | 542 | break; | |
| 543 | 543 | } | |
| 544 | 544 | path = delim + 1; | |
| 545 | 545 | } | |
| 546 | 546 | } | |
| 547 | 547 | else { | |
| 548 | - progpath[0] = '\0'; | ||
| 548 | + config->program_name[0] = '\0'; | ||
| 549 | 549 | } | |
| 550 | 550 | } | |
| 551 | 551 | ||
@@ -695,14 +695,9 @@ calculate_init(PyCalculatePath *calculate, | |||
| 695 | 695 | { | |
| 696 | 696 | calculate->home = main_config->home; | |
| 697 | 697 | calculate->module_search_path_env = main_config->module_search_path_env; | |
| 698 | + calculate->program_name = main_config->program_name; | ||
| 698 | 699 | ||
| 699 | 700 | calculate->path_env = _wgetenv(L"PATH"); | |
| 700 | - | ||
| 701 | - wchar_t *prog = Py_GetProgramName(); | ||
| 702 | - if (prog == NULL || *prog == '\0') { | ||
| 703 | - prog = L"python"; | ||
| 704 | - } | ||
| 705 | - calculate->prog = prog; | ||
| 706 | 701 | } | |
| 707 | 702 | ||
| 708 | 703 | ||
@@ -714,8 +709,8 @@ get_pth_filename(wchar_t *spbuffer, PyPathConfig *config) | |||
| 714 | 709 | return 1; | |
| 715 | 710 | } | |
| 716 | 711 | } | |
| 717 | - if (config->progpath[0]) { | ||
| 718 | - if (!change_ext(spbuffer, config->progpath, L"._pth") && exists(spbuffer)) { | ||
| 712 | + if (config->program_name[0]) { | ||
| 713 | + if (!change_ext(spbuffer, config->program_name, L"._pth") && exists(spbuffer)) { | ||
| 719 | 714 | return 1; | |
| 720 | 715 | } | |
| 721 | 716 | } | |
@@ -784,9 +779,9 @@ static void | |||
| 784 | 779 | calculate_path_impl(PyCalculatePath *calculate, PyPathConfig *config, | |
| 785 | 780 | const _PyMainInterpreterConfig *main_config) | |
| 786 | 781 | { | |
| 787 | - get_progpath(calculate, config->progpath, config->dllpath); | ||
| 788 | - /* progpath guaranteed \0 terminated in MAXPATH+1 bytes. */ | ||
| 789 | - wcscpy_s(calculate->argv0_path, MAXPATHLEN+1, config->progpath); | ||
| 782 | + get_progpath(calculate, config); | ||
| 783 | + /* program_name guaranteed \0 terminated in MAXPATH+1 bytes. */ | ||
| 784 | + wcscpy_s(calculate->argv0_path, MAXPATHLEN+1, config->program_name); | ||
| 790 | 785 | reduce(calculate->argv0_path); | |
| 791 | 786 | ||
| 792 | 787 | /* Search for a sys.path file */ | |
@@ -798,7 +793,7 @@ calculate_path_impl(PyCalculatePath *calculate, PyPathConfig *config, | |||
| 798 | 793 | ||
| 799 | 794 | /* Calculate zip archive path from DLL or exe path */ | |
| 800 | 795 | change_ext(calculate->zip_path, | |
| 801 | - config->dllpath[0] ? config->dllpath : config->progpath, | ||
| 796 | + config->dllpath[0] ? config->dllpath : config->program_name, | ||
| 802 | 797 | L".zip"); | |
| 803 | 798 | ||
| 804 | 799 | if (calculate->home == NULL || *calculate->home == '\0') { | |
@@ -1057,8 +1052,8 @@ Py_SetPath(const wchar_t *path) | |||
| 1057 | 1052 | return; | |
| 1058 | 1053 | } | |
| 1059 | 1054 | ||
| 1060 | - wchar_t *prog = Py_GetProgramName(); | ||
| 1061 | - wcsncpy(path_config.progpath, prog, MAXPATHLEN); | ||
| 1055 | + wchar_t *program_name = Py_GetProgramName(); | ||
| 1056 | + wcsncpy(path_config.program_name, program_name, MAXPATHLEN); | ||
| 1062 | 1057 | path_config.prefix[0] = L'\0'; | |
| 1063 | 1058 | path_config.module_search_path = PyMem_RawMalloc((wcslen(path) + 1) * sizeof(wchar_t)); | |
| 1064 | 1059 | if (path_config.module_search_path != NULL) { | |
@@ -1110,7 +1105,7 @@ Py_GetProgramFullPath(void) | |||
| 1110 | 1105 | if (!path_config.module_search_path) { | |
| 1111 | 1106 | calculate_path(NULL); | |
| 1112 | 1107 | } | |
| 1113 | - return path_config.progpath; | ||
| 1108 | + return path_config.program_name; | ||
| 1114 | 1109 | } | |
| 1115 | 1110 | ||
| 1116 | 1111 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments