diff -r 4e3c76cb0e8a Lib/os.py --- a/Lib/os.py Tue Mar 25 18:19:49 2014 +0100 +++ b/Lib/os.py Fri Mar 28 10:10:07 2014 +0100 @@ -208,7 +208,10 @@ SEEK_END = 2 def _get_masked_mode(mode): - mask = umask(0) + # Setting the umask changes it process-wide and so affect other threads, + # but there is no other way to get the current umask. Use 022 because this + # mask is the usual default. + mask = umask(0o022) umask(mask) return mode & ~mask