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
f2abc8f2
Kaydet (Commit)
f2abc8f2
authored
Eki 08, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #27998: Fixed bytes path support in os.scandir() on Windows.
Patch by Eryk Sun.
üst
bbc638cd
2674bc72
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
46 deletions
+46
-46
NEWS
Misc/NEWS
+3
-0
posixmodule.c
Modules/posixmodule.c
+43
-46
No files found.
Misc/NEWS
Dosyayı görüntüle @
f2abc8f2
...
...
@@ -70,6 +70,9 @@ Core and Builtins
Library
-------
- Issue #27998: Fixed bytes path support in os.scandir() on Windows.
Patch by Eryk Sun.
- Issue #28317: The disassembler now decodes FORMAT_VALUE argument.
- Issue #26293: Fixed writing ZIP files that starts not from the start of the
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
f2abc8f2
...
...
@@ -1337,29 +1337,39 @@ win32_error_object(const char* function, PyObject* filename)
#endif
/* MS_WINDOWS */
static
PyObject
*
path_
error
(
path_
t
*
path
)
path_
object_error
(
PyObjec
t
*
path
)
{
#ifdef MS_WINDOWS
return
PyErr_SetExcFromWindowsErrWithFilenameObject
(
PyExc_OSError
,
0
,
path
->
object
);
return
PyErr_SetExcFromWindowsErrWithFilenameObject
(
PyExc_OSError
,
0
,
path
);
#else
return
PyErr_SetFromErrnoWithFilenameObject
(
PyExc_OSError
,
path
->
object
);
return
PyErr_SetFromErrnoWithFilenameObject
(
PyExc_OSError
,
path
);
#endif
}
static
PyObject
*
path_
error2
(
path_t
*
path
,
path_
t
*
path2
)
path_
object_error2
(
PyObject
*
path
,
PyObjec
t
*
path2
)
{
#ifdef MS_WINDOWS
return
PyErr_SetExcFromWindowsErrWithFilenameObjects
(
PyExc_OSError
,
0
,
path
->
object
,
path2
->
object
);
return
PyErr_SetExcFromWindowsErrWithFilenameObjects
(
PyExc_OSError
,
0
,
path
,
path2
);
#else
return
PyErr_SetFromErrnoWithFilenameObjects
(
PyExc_OSError
,
path
->
object
,
path2
->
object
);
return
PyErr_SetFromErrnoWithFilenameObjects
(
PyExc_OSError
,
path
,
path2
);
#endif
}
static
PyObject
*
path_error
(
path_t
*
path
)
{
return
path_object_error
(
path
->
object
);
}
static
PyObject
*
path_error2
(
path_t
*
path
,
path_t
*
path2
)
{
return
path_object_error2
(
path
->
object
,
path2
->
object
);
}
/* POSIX generic methods */
...
...
@@ -11152,41 +11162,26 @@ static PyObject *
DirEntry_fetch_stat
(
DirEntry
*
self
,
int
follow_symlinks
)
{
int
result
;
struct
_Py_stat_struct
st
;
STRUCT_STAT
st
;
PyObject
*
ub
;
#ifdef MS_WINDOWS
const
wchar_t
*
path
;
path
=
PyUnicode_AsUnicode
(
self
->
path
);
if
(
!
path
)
return
NULL
;
if
(
follow_symlinks
)
result
=
win32_stat
(
path
,
&
st
);
else
result
=
win32_lstat
(
path
,
&
st
);
if
(
result
!=
0
)
{
return
PyErr_SetExcFromWindowsErrWithFilenameObject
(
PyExc_OSError
,
0
,
self
->
path
);
}
if
(
PyUnicode_FSDecoder
(
self
->
path
,
&
ub
))
{
const
wchar_t
*
path
=
PyUnicode_AsUnicode
(
ub
);
#else
/* POSIX */
PyObject
*
bytes
;
const
char
*
path
;
if
(
!
PyUnicode_FSConverter
(
self
->
path
,
&
bytes
))
if
(
PyUnicode_FSConverter
(
self
->
path
,
&
ub
))
{
const
char
*
path
=
PyBytes_AS_STRING
(
ub
);
#endif
if
(
follow_symlinks
)
result
=
STAT
(
path
,
&
st
);
else
result
=
LSTAT
(
path
,
&
st
);
Py_DECREF
(
ub
);
}
else
return
NULL
;
path
=
PyBytes_AS_STRING
(
bytes
);
if
(
follow_symlinks
)
result
=
STAT
(
path
,
&
st
);
else
result
=
LSTAT
(
path
,
&
st
);
Py_DECREF
(
bytes
);
if
(
result
!=
0
)
return
PyErr_SetFromErrnoWithFilenameObject
(
PyExc_OSError
,
self
->
path
);
#endif
return
path_object_error
(
self
->
path
);
return
_pystat_fromstructstat
(
&
st
);
}
...
...
@@ -11356,17 +11351,19 @@ DirEntry_inode(DirEntry *self)
{
#ifdef MS_WINDOWS
if
(
!
self
->
got_file_index
)
{
PyObject
*
unicode
;
const
wchar_t
*
path
;
struct
_Py_stat_struct
stat
;
STRUCT_STAT
stat
;
int
result
;
path
=
PyUnicode_AsUnicode
(
self
->
path
);
if
(
!
path
)
if
(
!
PyUnicode_FSDecoder
(
self
->
path
,
&
unicode
))
return
NULL
;
path
=
PyUnicode_AsUnicode
(
unicode
);
result
=
LSTAT
(
path
,
&
stat
);
Py_DECREF
(
unicode
);
if
(
win32_lstat
(
path
,
&
stat
)
!=
0
)
{
return
PyErr_SetExcFromWindowsErrWithFilenameObject
(
PyExc_OSError
,
0
,
self
->
path
);
}
if
(
result
!=
0
)
return
path_object_error
(
self
->
path
);
self
->
win32_file_index
=
stat
.
st_ino
;
self
->
got_file_index
=
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