[Python-checkins] cpython (3.5): Issue #25846: Fix usage of Py_ARRAY_LENGTH() in win32_wchdir()

victor.stinner python-checkins at python.org
Sun Dec 13 15:41:19 EST 2015


https://hg.python.org/cpython/rev/39ce98d9b6b7
changeset:   99552:39ce98d9b6b7
branch:      3.5
parent:      99550:d28268c47421
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sun Dec 13 21:40:26 2015 +0100
summary:
  Issue #25846: Fix usage of Py_ARRAY_LENGTH() in win32_wchdir()

files:
  Modules/posixmodule.c |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1345,13 +1345,13 @@
 static BOOL __stdcall
 win32_wchdir(LPCWSTR path)
 {
-    wchar_t _new_path[MAX_PATH], *new_path = _new_path;
+    wchar_t path_buf[MAX_PATH], *new_path = path_buf;
     int result;
     wchar_t env[4] = L"=x:";
 
     if(!SetCurrentDirectoryW(path))
         return FALSE;
-    result = GetCurrentDirectoryW(Py_ARRAY_LENGTH(new_path), new_path);
+    result = GetCurrentDirectoryW(Py_ARRAY_LENGTH(path_buf), new_path);
     if (!result)
         return FALSE;
     if (result > Py_ARRAY_LENGTH(new_path)) {
@@ -1372,7 +1372,7 @@
         return TRUE;
     env[1] = new_path[0];
     result = SetEnvironmentVariableW(env, new_path);
-    if (new_path != _new_path)
+    if (new_path != path_buf)
         PyMem_RawFree(new_path);
     return result;
 }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list