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
ad158728
Kaydet (Commit)
ad158728
authored
Eki 27, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplify PyUnicode_Encode/DecodeFSDefault on Windows/Mac OS X
* Windows always uses mbcs * Mac OS X always uses utf-8
üst
91b47c64
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
unicodeobject.c
Objects/unicodeobject.c
+15
-13
No files found.
Objects/unicodeobject.c
Dosyayı görüntüle @
ad158728
...
...
@@ -1584,15 +1584,19 @@ PyObject *PyUnicode_AsEncodedObject(PyObject *unicode,
return
NULL
;
}
PyObject
*
PyUnicode_EncodeFSDefault
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_EncodeFSDefault
(
PyObject
*
unicode
)
{
if
(
Py_FileSystemDefaultEncoding
)
{
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
if
(
strcmp
(
Py_FileSystemDefaultEncoding
,
"mbcs"
)
==
0
)
return
PyUnicode_EncodeMBCS
(
PyUnicode_AS_UNICODE
(
unicode
),
PyUnicode_GET_SIZE
(
unicode
),
NULL
);
#endif
#elif defined(__APPLE__)
return
PyUnicode_EncodeUTF8
(
PyUnicode_AS_UNICODE
(
unicode
),
PyUnicode_GET_SIZE
(
unicode
),
"surrogateescape"
);
#else
if
(
Py_FileSystemDefaultEncoding
)
{
return
PyUnicode_AsEncodedString
(
unicode
,
Py_FileSystemDefaultEncoding
,
"surrogateescape"
);
...
...
@@ -1615,6 +1619,7 @@ PyObject *PyUnicode_EncodeFSDefault(PyObject *unicode)
PyMem_Free
(
bytes
);
return
bytes_obj
;
}
#endif
}
PyObject
*
PyUnicode_AsEncodedString
(
PyObject
*
unicode
,
...
...
@@ -1761,21 +1766,17 @@ PyUnicode_DecodeFSDefault(const char *s) {
PyObject
*
PyUnicode_DecodeFSDefaultAndSize
(
const
char
*
s
,
Py_ssize_t
size
)
{
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
return
PyUnicode_DecodeMBCS
(
s
,
size
,
NULL
);
#elif defined(__APPLE__)
return
PyUnicode_DecodeUTF8
(
s
,
size
,
"surrogateescape"
);
#else
/* During the early bootstrapping process, Py_FileSystemDefaultEncoding
can be undefined. If it is case, decode using UTF-8. The following assumes
that Py_FileSystemDefaultEncoding is set to a built-in encoding during the
bootstrapping process where the codecs aren't ready yet.
*/
if
(
Py_FileSystemDefaultEncoding
)
{
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
if
(
strcmp
(
Py_FileSystemDefaultEncoding
,
"mbcs"
)
==
0
)
{
return
PyUnicode_DecodeMBCS
(
s
,
size
,
NULL
);
}
#elif defined(__APPLE__)
if
(
strcmp
(
Py_FileSystemDefaultEncoding
,
"utf-8"
)
==
0
)
{
return
PyUnicode_DecodeUTF8
(
s
,
size
,
"surrogateescape"
);
}
#endif
return
PyUnicode_Decode
(
s
,
size
,
Py_FileSystemDefaultEncoding
,
"surrogateescape"
);
...
...
@@ -1799,6 +1800,7 @@ PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
PyMem_Free
(
wchar
);
return
unicode
;
}
#endif
}
...
...
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