| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -343,12 +343,12 @@ PyConfig | |||
| 343 | 343 | ||
| 344 | 344 | Structure methods: | |
| 345 | 345 | ||
| 346 | - .. c:function:: PyStatus PyConfig_InitPythonConfig(PyConfig *config) | ||
| 346 | + .. c:function:: void PyConfig_InitPythonConfig(PyConfig *config) | ||
| 347 | 347 | ||
| 348 | 348 | Initialize configuration with :ref:`Python Configuration | |
| 349 | 349 | <init-python-config>`. | |
| 350 | 350 | ||
| 351 | - .. c:function:: PyStatus PyConfig_InitIsolatedConfig(PyConfig *config) | ||
| 351 | + .. c:function:: void PyConfig_InitIsolatedConfig(PyConfig *config) | ||
| 352 | 352 | ||
| 353 | 353 | Initialize configuration with :ref:`Isolated Configuration | |
| 354 | 354 | <init-isolated-conf>`. | |
@@ -724,12 +724,9 @@ Example setting the program name:: | |||
| 724 | 724 | void init_python(void) | |
| 725 | 725 | { | |
| 726 | 726 | PyStatus status; | |
| 727 | - PyConfig config; | ||
| 728 | 727 | ||
| 729 | - status = PyConfig_InitPythonConfig(&config); | ||
| 730 | - if (PyStatus_Exception(status)) { | ||
| 731 | - goto fail; | ||
| 732 | - } | ||
| 728 | + PyConfig config; | ||
| 729 | + PyConfig_InitPythonConfig(&config); | ||
| 733 | 730 | ||
| 734 | 731 | /* Set the program name. Implicitly preinitialize Python. */ | |
| 735 | 732 | status = PyConfig_SetString(&config, &config.program_name, | |
@@ -756,12 +753,9 @@ configuration, and then override some parameters:: | |||
| 756 | 753 | PyStatus init_python(const char *program_name) | |
| 757 | 754 | { | |
| 758 | 755 | PyStatus status; | |
| 759 | - PyConfig config; | ||
| 760 | 756 | ||
| 761 | - status = PyConfig_InitPythonConfig(&config); | ||
| 762 | - if (PyStatus_Exception(status)) { | ||
| 763 | - goto done; | ||
| 764 | - } | ||
| 757 | + PyConfig config; | ||
| 758 | + PyConfig_InitPythonConfig(&config); | ||
| 765 | 759 | ||
| 766 | 760 | /* Set the program name before reading the configuraton | |
| 767 | 761 | (decode byte string from the locale encoding). | |
@@ -843,13 +837,9 @@ Example of customized Python always running in isolated mode:: | |||
| 843 | 837 | int main(int argc, char **argv) | |
| 844 | 838 | { | |
| 845 | 839 | PyStatus status; | |
| 846 | - PyConfig config; | ||
| 847 | - | ||
| 848 | - status = PyConfig_InitPythonConfig(&config); | ||
| 849 | - if (PyStatus_Exception(status)) { | ||
| 850 | - goto fail; | ||
| 851 | - } | ||
| 852 | 840 | ||
| 841 | + PyConfig config; | ||
| 842 | + PyConfig_InitPythonConfig(&config); | ||
| 853 | 843 | config.isolated = 1; | |
| 854 | 844 | ||
| 855 | 845 | /* Decode command line arguments. | |
@@ -1034,14 +1024,9 @@ phases:: | |||
| 1034 | 1024 | void init_python(void) | |
| 1035 | 1025 | { | |
| 1036 | 1026 | PyStatus status; | |
| 1037 | - PyConfig config; | ||
| 1038 | - | ||
| 1039 | - status = PyConfig_InitPythonConfig(&config); | ||
| 1040 | - if (PyStatus_Exception(status)) { | ||
| 1041 | - PyConfig_Clear(&config); | ||
| 1042 | - Py_ExitStatusException(status); | ||
| 1043 | - } | ||
| 1044 | 1027 | ||
| 1028 | + PyConfig config; | ||
| 1029 | + PyConfig_InitPythonConfig(&config); | ||
| 1045 | 1030 | config._init_main = 0; | |
| 1046 | 1031 | ||
| 1047 | 1032 | /* ... customize 'config' configuration ... */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -404,8 +404,8 @@ typedef struct { | |||
| 404 | 404 | int _init_main; | |
| 405 | 405 | } PyConfig; | |
| 406 | 406 | ||
| 407 | - PyAPI_FUNC(PyStatus) PyConfig_InitPythonConfig(PyConfig *config); | ||
| 408 | - PyAPI_FUNC(PyStatus) PyConfig_InitIsolatedConfig(PyConfig *config); | ||
| 407 | + PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config); | ||
| 408 | + PyAPI_FUNC(void) PyConfig_InitIsolatedConfig(PyConfig *config); | ||
| 409 | 409 | PyAPI_FUNC(void) PyConfig_Clear(PyConfig *); | |
| 410 | 410 | PyAPI_FUNC(PyStatus) PyConfig_SetString( | |
| 411 | 411 | PyConfig *config, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,7 +144,7 @@ typedef enum { | |||
| 144 | 144 | _PyConfig_INIT_ISOLATED = 3 | |
| 145 | 145 | } _PyConfigInitEnum; | |
| 146 | 146 | ||
| 147 | - PyAPI_FUNC(PyStatus) _PyConfig_InitCompatConfig(PyConfig *config); | ||
| 147 | + PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config); | ||
| 148 | 148 | extern PyStatus _PyConfig_Copy( | |
| 149 | 149 | PyConfig *config, | |
| 150 | 150 | const PyConfig *config2); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,11 +61,7 @@ pymain_init(const _PyArgv *args) | |||
| 61 | 61 | } | |
| 62 | 62 | ||
| 63 | 63 | PyConfig config; | |
| 64 | - | ||
| 65 | - status = PyConfig_InitPythonConfig(&config); | ||
| 66 | - if (_PyStatus_EXCEPTION(status)) { | ||
| 67 | - goto done; | ||
| 68 | - } | ||
| 64 | + PyConfig_InitPythonConfig(&config); | ||
| 69 | 65 | ||
| 70 | 66 | /* pass NULL as the config: config is read from command line arguments, | |
| 71 | 67 | environment variables, configuration files */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -193,10 +193,7 @@ wmain(int argc, wchar_t **argv) | |||
| 193 | 193 | } | |
| 194 | 194 | } | |
| 195 | 195 | ||
| 196 | - status = PyConfig_InitPythonConfig(&config); | ||
| 197 | - if (PyStatus_Exception(status)) { | ||
| 198 | - goto fail_without_config; | ||
| 199 | - } | ||
| 196 | + PyConfig_InitPythonConfig(&config); | ||
| 200 | 197 | ||
| 201 | 198 | status = PyConfig_SetArgv(&config, argc, argv); | |
| 202 | 199 | if (PyStatus_Exception(status)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,17 +76,12 @@ main(int argc, char *argv[]) | |||
| 76 | 76 | } | |
| 77 | 77 | text[text_size] = '\0'; | |
| 78 | 78 | ||
| 79 | - PyStatus status; | ||
| 80 | 79 | PyConfig config; | |
| 81 | - | ||
| 82 | - status = PyConfig_InitIsolatedConfig(&config); | ||
| 83 | - if (PyStatus_Exception(status)) { | ||
| 84 | - PyConfig_Clear(&config); | ||
| 85 | - Py_ExitStatusException(status); | ||
| 86 | - } | ||
| 80 | + PyConfig_InitIsolatedConfig(&config); | ||
| 87 | 81 | ||
| 88 | 82 | config.site_import = 0; | |
| 89 | 83 | ||
| 84 | + PyStatus status; | ||
| 90 | 85 | status = PyConfig_SetString(&config, &config.program_name, | |
| 91 | 86 | L"./_freeze_importlib"); | |
| 92 | 87 | if (PyStatus_Exception(status)) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments