Merged revisions 67154,67157-67159,67162-67163,67166,67175-67176,67189,67224-67225,67243 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67154 | hirokazu.yamamoto | 2008-11-08 04:46:17 +0100 (Sat, 08 Nov 2008) | 1 line

  Issue #4071: ntpath.abspath returned an empty string for long unicode path.
........
  r67157 | georg.brandl | 2008-11-08 12:47:44 +0100 (Sat, 08 Nov 2008) | 2 lines

  Don't use "HOWTO" as the title for all howto .tex files.
........
  r67158 | georg.brandl | 2008-11-08 12:48:20 +0100 (Sat, 08 Nov 2008) | 2 lines

  Update "Documenting" a bit. Concentrate on Python-specifics.
........
  r67159 | georg.brandl | 2008-11-08 13:52:25 +0100 (Sat, 08 Nov 2008) | 2 lines

  Fix warning.
........
  r67162 | benjamin.peterson | 2008-11-08 17:55:33 +0100 (Sat, 08 Nov 2008) | 1 line

  a few compile() and ast doc improvements
........
  r67163 | benjamin.peterson | 2008-11-08 18:04:18 +0100 (Sat, 08 Nov 2008) | 1 line

  move context clue to versionchanged tag
........
  r67166 | benjamin.peterson | 2008-11-08 18:07:06 +0100 (Sat, 08 Nov 2008) | 1 line

  clarify what was added
........
  r67175 | benjamin.peterson | 2008-11-09 02:44:32 +0100 (Sun, 09 Nov 2008) | 1 line

  update link
........
  r67176 | benjamin.peterson | 2008-11-09 02:52:32 +0100 (Sun, 09 Nov 2008) | 1 line

  fix comment
........
  r67189 | benjamin.peterson | 2008-11-11 22:56:06 +0100 (Tue, 11 Nov 2008) | 1 line

  use correct name
........
  r67224 | georg.brandl | 2008-11-15 09:10:04 +0100 (Sat, 15 Nov 2008) | 2 lines

  #4324: fix getlocale() argument.
........
  r67225 | brett.cannon | 2008-11-15 23:33:25 +0100 (Sat, 15 Nov 2008) | 1 line

  Clarify the docs for the 'strict' argument to httplib.HTTPConnection.
........
  r67243 | benjamin.peterson | 2008-11-17 22:39:05 +0100 (Mon, 17 Nov 2008) | 1 line

  a few fixes on the download page
........
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 4c580c4..1d0b7ec 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2393,13 +2393,27 @@
 	if (unicode_file_names()) {
 		PyUnicodeObject *po;
 		if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) {
-			Py_UNICODE woutbuf[MAX_PATH*2];
+			Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po);
+			Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf;
 			Py_UNICODE *wtemp;
-			if (!GetFullPathNameW(PyUnicode_AS_UNICODE(po),
-						sizeof(woutbuf)/sizeof(woutbuf[0]),
-						 woutbuf, &wtemp))
-				return win32_error("GetFullPathName", "");
-			return PyUnicode_FromUnicode(woutbuf, wcslen(woutbuf));
+			DWORD result;
+			PyObject *v;
+			result = GetFullPathNameW(wpath,
+						   sizeof(woutbuf)/sizeof(woutbuf[0]),
+						    woutbuf, &wtemp);
+			if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) {
+				woutbufp = malloc(result * sizeof(Py_UNICODE));
+				if (!woutbufp)
+					return PyErr_NoMemory();
+				result = GetFullPathNameW(wpath, result, woutbufp, &wtemp);
+			}
+			if (result)
+				v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp));
+			else
+				v = win32_error_unicode("GetFullPathNameW", wpath);
+			if (woutbufp != woutbuf)
+				free(woutbufp);
+			return v;
 		}
 		/* Drop the argument parsing error as narrow strings
 		   are also valid. */