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
1db7c13b
Kaydet (Commit)
1db7c13b
authored
Kas 10, 2011
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Port encoders from Py_UNICODE API to unicode object API.
üst
df8077ec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
76 deletions
+62
-76
unicodeobject.h
Include/unicodeobject.h
+16
-0
_codecsmodule.c
Modules/_codecsmodule.c
+46
-76
unicodeobject.c
Objects/unicodeobject.c
+0
-0
No files found.
Include/unicodeobject.h
Dosyayı görüntüle @
1db7c13b
...
...
@@ -1088,6 +1088,12 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
int
base64WhiteSpace
,
/* Encode whitespace (sp, ht, nl, cr) in base64 */
const
char
*
errors
/* error handling */
);
PyAPI_FUNC
(
PyObject
*
)
_PyUnicode_EncodeUTF7
(
PyObject
*
unicode
,
/* Unicode object */
int
base64SetO
,
/* Encode RFC2152 Set O characters in base64 */
int
base64WhiteSpace
,
/* Encode whitespace (sp, ht, nl, cr) in base64 */
const
char
*
errors
/* error handling */
);
#endif
/* --- UTF-8 Codecs ------------------------------------------------------- */
...
...
@@ -1195,6 +1201,11 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
const
char
*
errors
,
/* error handling */
int
byteorder
/* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
PyAPI_FUNC
(
PyObject
*
)
_PyUnicode_EncodeUTF32
(
PyObject
*
object
,
/* Unicode object */
const
char
*
errors
,
/* error handling */
int
byteorder
/* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
#endif
/* --- UTF-16 Codecs ------------------------------------------------------ */
...
...
@@ -1275,6 +1286,11 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
const
char
*
errors
,
/* error handling */
int
byteorder
/* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
PyAPI_FUNC
(
PyObject
*
)
_PyUnicode_EncodeUTF16
(
PyObject
*
unicode
,
/* Unicode object */
const
char
*
errors
,
/* error handling */
int
byteorder
/* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
#endif
/* --- Unicode-Escape Codecs ---------------------------------------------- */
...
...
Modules/_codecsmodule.c
Dosyayı görüntüle @
1db7c13b
...
...
@@ -235,8 +235,10 @@ unicode_internal_decode(PyObject *self,
return
NULL
;
if
(
PyUnicode_Check
(
obj
))
{
if
(
PyUnicode_READY
(
obj
)
<
0
)
return
NULL
;
Py_INCREF
(
obj
);
return
codec_tuple
(
obj
,
PyUnicode_GET_
SIZE
(
obj
));
return
codec_tuple
(
obj
,
PyUnicode_GET_
LENGTH
(
obj
));
}
else
{
if
(
PyObject_AsReadBuffer
(
obj
,
(
const
void
**
)
&
data
,
&
size
))
...
...
@@ -676,10 +678,12 @@ unicode_internal_encode(PyObject *self,
return
NULL
;
if
(
PyUnicode_Check
(
obj
))
{
if
(
PyUnicode_READY
(
obj
)
<
0
)
return
NULL
;
data
=
PyUnicode_AS_DATA
(
obj
);
size
=
PyUnicode_GET_DATA_SIZE
(
obj
);
return
codec_tuple
(
PyBytes_FromStringAndSize
(
data
,
size
),
PyUnicode_GET_
SIZE
(
obj
));
PyUnicode_GET_
LENGTH
(
obj
));
}
else
{
if
(
PyObject_AsReadBuffer
(
obj
,
(
const
void
**
)
&
data
,
&
size
))
...
...
@@ -700,14 +704,10 @@ utf_7_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUTF7
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
0
,
0
,
errors
),
PyUnicode_GET_SIZE
(
str
));
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
_PyUnicode_EncodeUTF7
(
str
,
0
,
0
,
errors
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -752,13 +752,10 @@ utf_16_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUTF16
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
,
byteorder
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_EncodeUTF16
(
str
,
errors
,
byteorder
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -775,13 +772,10 @@ utf_16_le_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUTF16
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
,
-
1
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_EncodeUTF16
(
str
,
errors
,
-
1
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -798,13 +792,10 @@ utf_16_be_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUTF16
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
,
+
1
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_EncodeUTF16
(
str
,
errors
,
+
1
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -829,13 +820,10 @@ utf_32_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUTF32
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
,
byteorder
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_EncodeUTF32
(
str
,
errors
,
byteorder
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -852,13 +840,10 @@ utf_32_le_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUTF32
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
,
-
1
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_EncodeUTF32
(
str
,
errors
,
-
1
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -875,13 +860,10 @@ utf_32_be_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUTF32
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
,
+
1
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_EncodeUTF32
(
str
,
errors
,
+
1
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -898,11 +880,10 @@ unicode_escape_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeUnicodeEscape
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
)),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
PyUnicode_AsUnicodeEscapeString
(
str
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -919,12 +900,10 @@ raw_unicode_escape_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeRawUnicodeEscape
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
)),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
PyUnicode_AsRawUnicodeEscapeString
(
str
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -941,13 +920,10 @@ latin_1_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeLatin1
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_AsLatin1String
(
str
,
errors
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -964,13 +940,10 @@ ascii_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeASCII
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
_PyUnicode_AsASCIIString
(
str
,
errors
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -990,10 +963,10 @@ charmap_encode(PyObject *self,
mapping
=
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
_PyUnicode_EncodeCharmap
(
str
,
mapping
,
errors
),
PyUnicode_GET_
SIZE
(
str
));
PyUnicode_GET_
LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -1021,13 +994,10 @@ mbcs_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeMBCS
(
PyUnicode_AS_UNICODE
(
str
),
PyUnicode_GET_SIZE
(
str
),
errors
),
PyUnicode_GET_SIZE
(
str
));
v
=
codec_tuple
(
PyUnicode_EncodeCodePage
(
CP_ACP
,
str
,
errors
),
PyUnicode_GET_LENGTH
(
str
));
Py_DECREF
(
str
);
return
v
;
}
...
...
@@ -1045,7 +1015,7 @@ code_page_encode(PyObject *self,
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
)
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
return
NULL
;
v
=
codec_tuple
(
PyUnicode_EncodeCodePage
(
code_page
,
str
,
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
1db7c13b
This diff is collapsed.
Click to expand it.
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