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
4f4402c4
Kaydet (Commit)
4f4402c4
authored
Agu 14, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9425: Create private _Py_stat() function
Use stat() or _wstat() depending on the OS.
üst
4c9aa451
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
Python.h
Include/Python.h
+5
-0
import.c
Python/import.c
+33
-0
No files found.
Include/Python.h
Dosyayı görüntüle @
4f4402c4
...
...
@@ -135,6 +135,11 @@ PyAPI_FUNC(wchar_t *) _Py_char2wchar(char *);
PyAPI_FUNC
(
char
*
)
_Py_wchar2char
(
const
wchar_t
*
text
);
PyAPI_FUNC
(
FILE
*
)
_Py_wfopen
(
const
wchar_t
*
path
,
const
wchar_t
*
mode
);
/* _Py_stat lives in import.c */
#ifdef HAVE_STAT
int
_Py_stat
(
PyObject
*
unicode
,
struct
stat
*
statbuf
);
#endif
#ifdef __cplusplus
}
#endif
...
...
Python/import.c
Dosyayı görüntüle @
4f4402c4
...
...
@@ -1962,6 +1962,39 @@ case_ok(char *buf, Py_ssize_t len, Py_ssize_t namelen, char *name)
#ifdef HAVE_STAT
/* Call _wstat() on Windows, or stat() otherwise. Only fill st_mode
attribute on Windows. Return 0 on success, -1 on stat error or (if
PyErr_Occurred()) unicode error. */
int
_Py_stat
(
PyObject
*
unicode
,
struct
stat
*
statbuf
)
{
#ifdef MS_WINDOWS
wchar_t
path
[
MAXPATHLEN
+
1
];
Py_ssize_t
len
;
int
err
;
struct
_stat
wstatbuf
;
len
=
PyUnicode_AsWideChar
((
PyUnicodeObject
*
)
unicode
,
path
,
sizeof
(
path
)
/
sizeof
(
path
[
0
]));
if
(
len
==
-
1
)
return
-
1
;
err
=
_wstat
(
path
,
&
wstatbuf
);
if
(
!
err
)
statbuf
->
st_mode
=
wstatbuf
.
st_mode
;
return
err
;
#else
int
ret
;
PyObject
*
bytes
=
PyUnicode_EncodeFSDefault
(
unicode
);
if
(
bytes
==
NULL
)
return
-
1
;
ret
=
stat
(
PyBytes_AS_STRING
(
bytes
),
statbuf
);
Py_DECREF
(
bytes
);
return
ret
;
#endif
}
/* Helper to look for __init__.py or __init__.py[co] in potential package */
static
int
find_init_module
(
char
*
buf
)
...
...
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