comparison Python/sysmodule.c @ 43761:658cd34a8c5d

Fixed a bug in PyUnicode_DecodeFSDefault. strcmp() returns 0 on success. Added PyUnicode_DecodeFSDefaultAndSize Fixed a problem with the sys.path code that caused a segfault on Windows when the path contains non ASCII chars. The code for sys.executable, exec_prefix and prefix should be fixed, too.
author Christian Heimes <christian@cheimes.de>
date Sun, 04 Nov 2007 11:43:14 +0000
parents 1998ee0eff2c
children 0d462d789b18
comparison
equal deleted inserted replaced
43760:e90065e17212 43761:658cd34a8c5d
1148 return NULL; 1148 return NULL;
1149 for (i = 0; ; i++) { 1149 for (i = 0; ; i++) {
1150 p = strchr(path, delim); 1150 p = strchr(path, delim);
1151 if (p == NULL) 1151 if (p == NULL)
1152 p = strchr(path, '\0'); /* End of string */ 1152 p = strchr(path, '\0'); /* End of string */
1153 w = PyUnicode_FromStringAndSize(path, (Py_ssize_t) (p - path)); 1153 w = PyUnicode_DecodeFSDefaultAndSize(path, (Py_ssize_t) (p - path));
1154 if (w == NULL) { 1154 if (w == NULL) {
1155 Py_DECREF(v); 1155 Py_DECREF(v);
1156 return NULL; 1156 return NULL;
1157 } 1157 }
1158 PyList_SetItem(v, i, w); 1158 PyList_SetItem(v, i, w);