Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
bf3c1c32
Kaydet (Commit)
bf3c1c32
authored
Eyl 18, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #28075: Fix test_access_denied in Python 3.5
I forgot there two variations of os.stat() in Python 3.5.
üst
17a564ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
test_os.py
Lib/test/test_os.py
+14
-12
posixmodule.c
Modules/posixmodule.c
+4
-2
No files found.
Lib/test/test_os.py
Dosyayı görüntüle @
bf3c1c32
...
...
@@ -82,6 +82,11 @@ else:
# Issue #14110: Some tests fail on FreeBSD if the user is in the wheel group.
HAVE_WHEEL_GROUP
=
sys
.
platform
.
startswith
(
'freebsd'
)
and
os
.
getgid
()
==
0
def
create_file
(
filename
,
content
=
b
'content'
):
with
open
(
filename
,
"xb"
,
0
)
as
fp
:
fp
.
write
(
content
)
# Tests creating TESTFN
class
FileTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -226,15 +231,9 @@ class FileTests(unittest.TestCase):
# Test attributes on return values from os.*stat* family.
class
StatAttributeTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
os
.
mkdir
(
support
.
TESTFN
)
self
.
fname
=
os
.
path
.
join
(
support
.
TESTFN
,
"f1"
)
f
=
open
(
self
.
fname
,
'wb'
)
f
.
write
(
b
"ABC"
)
f
.
close
()
def
tearDown
(
self
):
os
.
unlink
(
self
.
fname
)
os
.
rmdir
(
support
.
TESTFN
)
self
.
fname
=
support
.
TESTFN
self
.
addCleanup
(
support
.
unlink
,
self
.
fname
)
create_file
(
self
.
fname
,
b
"ABC"
)
@unittest.skipUnless
(
hasattr
(
os
,
'stat'
),
'test needs os.stat()'
)
def
check_stat_attributes
(
self
,
fname
):
...
...
@@ -426,7 +425,11 @@ class StatAttributeTests(unittest.TestCase):
0
)
# test directory st_file_attributes (FILE_ATTRIBUTE_DIRECTORY set)
result
=
os
.
stat
(
support
.
TESTFN
)
dirname
=
support
.
TESTFN
+
"dir"
os
.
mkdir
(
dirname
)
self
.
addCleanup
(
os
.
rmdir
,
dirname
)
result
=
os
.
stat
(
dirname
)
self
.
check_file_attributes
(
result
)
self
.
assertEqual
(
result
.
st_file_attributes
&
stat
.
FILE_ATTRIBUTE_DIRECTORY
,
...
...
@@ -440,8 +443,7 @@ class StatAttributeTests(unittest.TestCase):
# supports file ACLs.
fname
=
os
.
path
.
join
(
os
.
environ
[
'TEMP'
],
self
.
fname
)
self
.
addCleanup
(
support
.
unlink
,
fname
)
with
open
(
fname
,
'xb'
,
0
)
as
fp
:
fp
.
write
(
b
'ABC'
)
create_file
(
fname
,
b
'ABC'
)
# Deny the right to [S]YNCHRONIZE on the file to
# force CreateFile to fail with ERROR_ACCESS_DENIED.
DETACHED_PROCESS
=
8
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
bf3c1c32
...
...
@@ -1607,7 +1607,9 @@ win32_xstat_impl_w(const wchar_t *path, struct _Py_stat_struct *result,
/* Either the target doesn't exist, or we don't have access to
get a handle to it. If the former, we need to return an error.
If the latter, we can use attributes_from_dir. */
if
(
GetLastError
()
!=
ERROR_SHARING_VIOLATION
)
DWORD
lastError
=
GetLastError
();
if
(
lastError
!=
ERROR_ACCESS_DENIED
&&
lastError
!=
ERROR_SHARING_VIOLATION
)
return
-
1
;
/* Could not get attributes on open file. Fall back to
reading the directory. */
...
...
@@ -1617,7 +1619,7 @@ win32_xstat_impl_w(const wchar_t *path, struct _Py_stat_struct *result,
if
(
info
.
dwFileAttributes
&
FILE_ATTRIBUTE_REPARSE_POINT
)
{
if
(
traverse
)
{
/* Should traverse, but could not open reparse point handle */
SetLastError
(
ERROR_SHARING_VIOLATION
);
SetLastError
(
lastError
);
return
-
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment