diff -Naur Python-2.7.9-orig/configure.ac Python-2.7.9/configure.ac
--- Python-2.7.9-orig/configure.ac	2014-12-11 13:49:46.506200000 +0300
+++ Python-2.7.9/configure.ac	2014-12-11 13:49:46.631000000 +0300
@@ -2459,6 +2459,13 @@
   *-*-mingw*) USE_WIN32_MODULE=;;
 esac
 
+# Determine if pwdmodule should be used.
+AC_SUBST(USE_PWD_MODULE)
+USE_PWD_MODULE=
+case $host in
+  *-*-mingw*) USE_PWD_MODULE='#';;
+esac
+
 # Determine if signalmodule should be used.
 AC_SUBST(USE_SIGNAL_MODULE)
 AC_SUBST(SIGNAL_OBJS)
diff -Naur Python-2.7.9-orig/Modules/Setup.config.in Python-2.7.9/Modules/Setup.config.in
--- Python-2.7.9-orig/Modules/Setup.config.in	2014-12-11 13:49:46.521800000 +0300
+++ Python-2.7.9/Modules/Setup.config.in	2014-12-11 13:49:46.631000000 +0300
@@ -6,6 +6,9 @@
 # init system calls(posix/nt/...) for INITFUNC (used by makesetup)
 @INITSYS@ posixmodule.c
 
+# This is needed to find out the user's home dir if $HOME is not set
+@USE_PWD_MODULE@pwd pwdmodule.c
+
 # Threading
 @USE_THREAD_MODULE@thread threadmodule.c
 
diff -Naur Python-2.7.9-orig/Modules/Setup.dist Python-2.7.9/Modules/Setup.dist
--- Python-2.7.9-orig/Modules/Setup.dist	2014-12-11 13:49:43.323800000 +0300
+++ Python-2.7.9/Modules/Setup.dist	2014-12-11 13:49:46.646600000 +0300
@@ -113,8 +113,6 @@
 # setup.py script in the root of the Python source tree.
 
 errno errnomodule.c		# posix (UNIX) errno values
-pwd pwdmodule.c			# this is needed to find out the user's home dir
-				# if $HOME is not set
 _sre _sre.c			# Fredrik Lundh's new regular expressions
 _codecs _codecsmodule.c		# access to the builtin codecs and codec registry
 _weakref _weakref.c             # weak references
