[Python-checkins] r47198 - in python/trunk: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c
martin.v.loewis
python-checkins at python.org
Sun Jul 2 20:44:01 CEST 2006
Author: martin.v.loewis
Date: Sun Jul 2 20:44:00 2006
New Revision: 47198
Modified:
python/trunk/Lib/test/test_os.py
python/trunk/Misc/NEWS
python/trunk/Modules/posixmodule.c
Log:
Correct arithmetic in access on Win32. Fixes #1513646.
Modified: python/trunk/Lib/test/test_os.py
==============================================================================
--- python/trunk/Lib/test/test_os.py (original)
+++ python/trunk/Lib/test/test_os.py Sun Jul 2 20:44:00 2006
@@ -11,6 +11,19 @@
warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__)
warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__)
+# Tests creating TESTFN
+class FileTests(unittest.TestCase):
+ def setUp(self):
+ if os.path.exists(test_support.TESTFN):
+ os.unlink(test_support.TESTFN)
+ tearDown = setUp
+
+ def test_access(self):
+ f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR)
+ os.close(f)
+ self.assert_(os.access(test_support.TESTFN, os.W_OK))
+
+
class TemporaryFileTests(unittest.TestCase):
def setUp(self):
self.files = []
@@ -393,6 +406,7 @@
def test_main():
test_support.run_unittest(
+ FileTests,
TemporaryFileTests,
StatAttributeTests,
EnvironTests,
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Jul 2 20:44:00 2006
@@ -52,6 +52,9 @@
Extension Modules
-----------------
+- Bug #1513646: os.access on Windows now correctly determines write
+ access, again.
+
- Bug #1512695: cPickle.loads could crash if it was interrupted with
a KeyboardInterrupt.
Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c (original)
+++ python/trunk/Modules/posixmodule.c Sun Jul 2 20:44:00 2006
@@ -1402,7 +1402,7 @@
return PyBool_FromLong(0);
/* Access is possible if either write access wasn't requested, or
the file isn't read-only. */
- return PyBool_FromLong(!(mode & 2) || !(attr && FILE_ATTRIBUTE_READONLY));
+ return PyBool_FromLong(!(mode & 2) || !(attr & FILE_ATTRIBUTE_READONLY));
#else
int res;
if (!PyArg_ParseTuple(args, "eti:access",
More information about the Python-checkins
mailing list