diff options
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/ceval.c | 6 | ||||
| -rw-r--r-- | Python/fileutils.c | 12 | ||||
| -rw-r--r-- | Python/getcopyright.c | 2 | ||||
| -rw-r--r-- | Python/pythonrun.c | 5 | ||||
| -rw-r--r-- | Python/sysmodule.c | 2 |
5 files changed, 14 insertions, 13 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index faee5cd44d..73925dc413 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2573,7 +2573,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) TARGET(WITH_CLEANUP) { - /* At the top of the stack are 1-3 values indicating + /* At the top of the stack are 1-6 values indicating how/why we entered the finally clause: - TOP = None - (TOP, SECOND) = (WHY_{RETURN,CONTINUE}), retval @@ -2586,9 +2586,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) otherwise we must call EXIT(None, None, None) - In the first two cases, we remove EXIT from the + In the first three cases, we remove EXIT from the stack, leaving the rest in the same order. In the - third case, we shift the bottom 3 values of the + fourth case, we shift the bottom 3 values of the stack down, and replace the empty spot with NULL. In addition, if the stack represents an exception, diff --git a/Python/fileutils.c b/Python/fileutils.c index b7c42e8e85..dbcb9234e0 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -623,7 +623,7 @@ int _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) { char *cpath; - char cbuf[PATH_MAX]; + char cbuf[MAXPATHLEN]; wchar_t *wbuf; int res; size_t r1; @@ -633,11 +633,11 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) errno = EINVAL; return -1; } - res = (int)readlink(cpath, cbuf, PATH_MAX); + res = (int)readlink(cpath, cbuf, Py_ARRAY_LENGTH(cbuf)); PyMem_Free(cpath); if (res == -1) return -1; - if (res == PATH_MAX) { + if (res == Py_ARRAY_LENGTH(cbuf)) { errno = EINVAL; return -1; } @@ -669,7 +669,7 @@ _Py_wrealpath(const wchar_t *path, wchar_t *resolved_path, size_t resolved_path_size) { char *cpath; - char cresolved_path[PATH_MAX]; + char cresolved_path[MAXPATHLEN]; wchar_t *wresolved_path; char *res; size_t r; @@ -709,11 +709,11 @@ _Py_wgetcwd(wchar_t *buf, size_t size) #ifdef MS_WINDOWS return _wgetcwd(buf, size); #else - char fname[PATH_MAX]; + char fname[MAXPATHLEN]; wchar_t *wname; size_t len; - if (getcwd(fname, PATH_MAX) == NULL) + if (getcwd(fname, Py_ARRAY_LENGTH(fname)) == NULL) return NULL; wname = _Py_char2wchar(fname, &len); if (wname == NULL) diff --git a/Python/getcopyright.c b/Python/getcopyright.c index 2d26787dfb..2b19622d43 100644 --- a/Python/getcopyright.c +++ b/Python/getcopyright.c @@ -2,7 +2,7 @@ #include "Python.h" -static char cprt[] = +static const char cprt[] = "\ Copyright (c) 2001-2013 Python Software Foundation.\n\ All Rights Reserved.\n\ diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 832df535f8..e02dbe2be1 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -817,8 +817,9 @@ Py_GetPythonHome(void) if (home == NULL && !Py_IgnoreEnvironmentFlag) { char* chome = Py_GETENV("PYTHONHOME"); if (chome) { - size_t r = mbstowcs(env_home, chome, PATH_MAX+1); - if (r != (size_t)-1 && r <= PATH_MAX) + size_t size = Py_ARRAY_LENGTH(env_home); + size_t r = mbstowcs(env_home, chome, size); + if (r != (size_t)-1 && r < size) home = env_home; } diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 1a41d2fa71..df9dfb1f0a 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1895,7 +1895,7 @@ sys_update_path(int argc, wchar_t **argv) #else /* All other filename syntaxes */ if (_HAVE_SCRIPT_ARGUMENT(argc, argv)) { #if defined(HAVE_REALPATH) - if (_Py_wrealpath(argv0, fullpath, PATH_MAX)) { + if (_Py_wrealpath(argv0, fullpath, Py_ARRAY_LENGTH(fullpath))) { argv0 = fullpath; } #endif |
