merge from trunk
diff --git a/Modules/_bisectmodule.c b/Modules/_bisectmodule.c
index b84509b..fe2e110 100644
--- a/Modules/_bisectmodule.c
+++ b/Modules/_bisectmodule.c
@@ -82,7 +82,7 @@
 	index = internal_bisect_right(list, item, lo, hi);
 	if (index < 0)
 		return NULL;
-	if (PyList_Check(list)) {
+	if (PyList_CheckExact(list)) {
 		if (PyList_Insert(list, index, item) < 0)
 			return NULL;
 	} else {
@@ -183,7 +183,7 @@
 	index = internal_bisect_left(list, item, lo, hi);
 	if (index < 0)
 		return NULL;
-	if (PyList_Check(list)) {
+	if (PyList_CheckExact(list)) {
 		if (PyList_Insert(list, index, item) < 0)
 			return NULL;
 	} else {
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index 5026c05..fc3e3f9 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -108,7 +108,7 @@
 to the default encoding. errors may be given to set a different error\n\
 handling scheme. Default is 'strict' meaning that encoding errors raise\n\
 a ValueError. Other possible values are 'ignore' and 'replace'\n\
-as well as any other name registerd with codecs.register_error that is\n\
+as well as any other name registered with codecs.register_error that is\n\
 able to handle ValueErrors.");
 
 static PyObject *
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 67c25b1..2732270 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -36,7 +36,7 @@
 Decodes `string' using I, an MultibyteCodec instance. errors may be given\n\
 to set a different error handling scheme. Default is 'strict' meaning\n\
 that encoding errors raise a UnicodeDecodeError. Other possible values\n\
-are 'ignore' and 'replace' as well as any other name registerd with\n\
+are 'ignore' and 'replace' as well as any other name registered with\n\
 codecs.register_error that is able to handle UnicodeDecodeErrors.");
 
 static char *codeckwarglist[] = {"input", "errors", NULL};
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 12ee9a8..c725b7d 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -751,11 +751,16 @@
 	if (!result)
 		return FALSE;
 	if (result > MAX_PATH+1) {
-		new_path = malloc(result);
+		new_path = malloc(result * sizeof(wchar_t));
 		if (!new_path) {
 			SetLastError(ERROR_OUTOFMEMORY);
 			return FALSE;
 		}
+		result = GetCurrentDirectoryW(result, new_path);
+		if (!result) {
+			free(new_path);
+			return FALSE;
+		}
 	}
 	if (wcsncmp(new_path, L"\\\\", 2) == 0 ||
 	    wcsncmp(new_path, L"//", 2) == 0)