mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
Correct arithmetic in access on Win32. Fixes #1513646.
This commit is contained in:
parent
762fbd3485
commit
ee1e06d497
3 changed files with 18 additions and 1 deletions
|
|
@ -11,6 +11,19 @@ from test import test_support
|
||||||
warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__)
|
warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__)
|
||||||
warnings.filterwarnings("ignore", "tmpnam", 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):
|
class TemporaryFileTests(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.files = []
|
self.files = []
|
||||||
|
|
@ -393,6 +406,7 @@ if sys.platform != 'win32':
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(
|
test_support.run_unittest(
|
||||||
|
FileTests,
|
||||||
TemporaryFileTests,
|
TemporaryFileTests,
|
||||||
StatAttributeTests,
|
StatAttributeTests,
|
||||||
EnvironTests,
|
EnvironTests,
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ Library
|
||||||
Extension Modules
|
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
|
- Bug #1512695: cPickle.loads could crash if it was interrupted with
|
||||||
a KeyboardInterrupt.
|
a KeyboardInterrupt.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1402,7 +1402,7 @@ finish:
|
||||||
return PyBool_FromLong(0);
|
return PyBool_FromLong(0);
|
||||||
/* Access is possible if either write access wasn't requested, or
|
/* Access is possible if either write access wasn't requested, or
|
||||||
the file isn't read-only. */
|
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
|
#else
|
||||||
int res;
|
int res;
|
||||||
if (!PyArg_ParseTuple(args, "eti:access",
|
if (!PyArg_ParseTuple(args, "eti:access",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue