summaryrefslogtreecommitdiffstats
path: root/Lib/dumbdbm.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-12-22 15:16:58 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2006-12-22 15:16:58 (GMT)
commit9ef0ef5b729b88491be1d28ab46248b645645c44 (patch)
treeb75b22ab777b177152ebc54dd9f490cf6414b706 /Lib/dumbdbm.py
parentdc26758ffeb33f6d59cb30b0019da9252e0cea1c (diff)
downloadcpython-9ef0ef5b729b88491be1d28ab46248b645645c44.zip
cpython-9ef0ef5b729b88491be1d28ab46248b645645c44.tar.gz
cpython-9ef0ef5b729b88491be1d28ab46248b645645c44.tar.bz2
[Bug #802128 continued] Modify mode depending on the process umask.
Is there really no other way to read the umask than to set it? Hope this works on Windows...
Diffstat (limited to 'Lib/dumbdbm.py')
-rw-r--r--Lib/dumbdbm.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/dumbdbm.py b/Lib/dumbdbm.py
index 9e9ffcc..2c7931d 100644
--- a/Lib/dumbdbm.py
+++ b/Lib/dumbdbm.py
@@ -236,4 +236,15 @@ def open(file, flag=None, mode=0666):
"""
# flag argument is currently ignored
+
+ # Modify mode depending on the umask
+ try:
+ um = _os.umask(0)
+ _os.umask(um)
+ except AttributeError:
+ pass
+ else:
+ # Turn off any bits that are set in the umask
+ mode = mode & (~um)
+
return _Database(file, mode)