diff options
| author | Victor Stinner <vstinner@redhat.com> | 2018-11-22 15:11:15 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-22 15:11:15 (GMT) |
| commit | a5194115733f6ca8fc1ddbee43eabbde536900e6 (patch) | |
| tree | df3d28fe96046fc8bf48acca76617ecb94c7da18 /Python/sysmodule.c | |
| parent | 18f3327d9a99163a658697465eb00c31f86535eb (diff) | |
| download | cpython-a5194115733f6ca8fc1ddbee43eabbde536900e6.zip cpython-a5194115733f6ca8fc1ddbee43eabbde536900e6.tar.gz cpython-a5194115733f6ca8fc1ddbee43eabbde536900e6.tar.bz2 | |
Revert "bpo-35239: _PySys_EndInit() copies module_search_path (GH-10532)" (GH-10660)
This reverts commit d2be9a5c13221fb84c2221bbfd93efac6111e697.
Diffstat (limited to 'Python/sysmodule.c')
| -rw-r--r-- | Python/sysmodule.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 48d8fa4..498fa91 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2464,20 +2464,7 @@ _PySys_EndInit(PyObject *sysdict, _PyMainInterpreterConfig *config) assert(config->exec_prefix != NULL); assert(config->base_exec_prefix != NULL); -#define COPY_LIST(KEY, ATTR) \ - do { \ - assert(PyList_Check(config->ATTR)); \ - PyObject *list = PyList_GetSlice(config->ATTR, \ - 0, PyList_GET_SIZE(config->ATTR)); \ - if (list == NULL) { \ - return -1; \ - } \ - SET_SYS_FROM_STRING_BORROW(KEY, list); \ - Py_DECREF(list); \ - } while (0) - - COPY_LIST("path", module_search_path); - + SET_SYS_FROM_STRING_BORROW("path", config->module_search_path); SET_SYS_FROM_STRING_BORROW("executable", config->executable); SET_SYS_FROM_STRING_BORROW("prefix", config->prefix); SET_SYS_FROM_STRING_BORROW("base_prefix", config->base_prefix); @@ -2488,19 +2475,12 @@ _PySys_EndInit(PyObject *sysdict, _PyMainInterpreterConfig *config) SET_SYS_FROM_STRING_BORROW("argv", config->argv); } if (config->warnoptions != NULL) { - COPY_LIST("warnoptions", warnoptions); + SET_SYS_FROM_STRING_BORROW("warnoptions", config->warnoptions); } if (config->xoptions != NULL) { - PyObject *dict = PyDict_Copy(config->xoptions); - if (dict == NULL) { - return -1; - } - SET_SYS_FROM_STRING_BORROW("_xoptions", dict); - Py_DECREF(dict); + SET_SYS_FROM_STRING_BORROW("_xoptions", config->xoptions); } -#undef COPY_LIST - /* Set flags to their final values */ SET_SYS_FROM_STRING_INT_RESULT("flags", make_flags()); /* prevent user from creating new instances */ |
