_wrealpath() and _Py_wreadlink() support surrogates (PEP 383)

Use _Py_wchar2char() to support surrogate characters in the input path.
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 97809d2..e95a91f 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1661,16 +1661,17 @@
 static wchar_t*
 _wrealpath(const wchar_t *path, wchar_t *resolved_path)
 {
-    char cpath[PATH_MAX];
+    char *cpath;
     char cresolved_path[PATH_MAX];
     char *res;
     size_t r;
-    r = wcstombs(cpath, path, PATH_MAX);
-    if (r == (size_t)-1 || r >= PATH_MAX) {
+    cpath = _Py_wchar2char(path);
+    if (cpath == NULL) {
         errno = EINVAL;
         return NULL;
     }
     res = realpath(cpath, cresolved_path);
+    PyMem_Free(cpath);
     if (res == NULL)
         return NULL;
     r = mbstowcs(resolved_path, cresolved_path, PATH_MAX);