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
052e4f18
Kaydet (Commit)
052e4f18
authored
Eyl 17, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #28075: Merge from 3.5
üst
d508d009
0b4dc484
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
test_os.py
Lib/test/test_os.py
+19
-0
NEWS
Misc/NEWS
+3
-0
posixmodule.c
Modules/posixmodule.c
+4
-2
No files found.
Lib/test/test_os.py
Dosyayı görüntüle @
052e4f18
...
...
@@ -460,6 +460,25 @@ class StatAttributeTests(unittest.TestCase):
result
.
st_file_attributes
&
stat
.
FILE_ATTRIBUTE_DIRECTORY
,
stat
.
FILE_ATTRIBUTE_DIRECTORY
)
@unittest.skipUnless
(
sys
.
platform
==
"win32"
,
"Win32 specific tests"
)
def
test_access_denied
(
self
):
# Default to FindFirstFile WIN32_FIND_DATA when access is
# denied. See issue 28075.
# os.environ['TEMP'] should be located on a volume that
# supports file ACLs.
fname
=
os
.
path
.
join
(
os
.
environ
[
'TEMP'
],
self
.
fname
)
self
.
addCleanup
(
support
.
unlink
,
fname
)
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
subprocess
.
check_call
(
[
'icacls.exe'
,
fname
,
'/deny'
,
'Users:(S)'
],
creationflags
=
DETACHED_PROCESS
)
result
=
os
.
stat
(
fname
)
self
.
assertNotEqual
(
result
.
st_size
,
0
)
class
UtimeTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
052e4f18
...
...
@@ -27,6 +27,9 @@ Core and Builtins
Library
-------
-
Issue
#
28075
:
Check
for
ERROR_ACCESS_DENIED
in
Windows
implementation
of
os
.
stat
().
Patch
by
Eryk
Sun
.
-
Issue
#
22493
:
Warning
message
emitted
by
using
inline
flags
in
the
middle
of
regular
expression
now
contains
a
(
truncated
)
regex
pattern
.
Patch
by
Tim
Graham
.
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
052e4f18
...
...
@@ -1545,7 +1545,9 @@ win32_xstat_impl(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. */
...
...
@@ -1555,7 +1557,7 @@ win32_xstat_impl(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