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
e1e04ad8
Kaydet (Commit)
e1e04ad8
authored
May 14, 2014
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Backed out changeset 6ceedbd88b5f
üst
b78c448f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
22 deletions
+6
-22
test_codecs.py
Lib/test/test_codecs.py
+0
-12
_codecsmodule.c
Modules/_codecsmodule.c
+6
-10
No files found.
Lib/test/test_codecs.py
Dosyayı görüntüle @
e1e04ad8
...
...
@@ -1600,12 +1600,6 @@ class CodecsModuleTest(unittest.TestCase):
self
.
assertEqual
(
codecs
.
decode
(
b
'abc'
),
'abc'
)
self
.
assertRaises
(
UnicodeDecodeError
,
codecs
.
decode
,
b
'
\xff
'
,
'ascii'
)
# test keywords
self
.
assertEqual
(
codecs
.
decode
(
obj
=
b
'
\xe4\xf6\xfc
'
,
encoding
=
'latin-1'
),
'
\xe4\xf6\xfc
'
)
self
.
assertEqual
(
codecs
.
decode
(
b
'[
\xff
]'
,
'ascii'
,
errors
=
'ignore'
),
'[]'
)
def
test_encode
(
self
):
self
.
assertEqual
(
codecs
.
encode
(
'
\xe4\xf6\xfc
'
,
'latin-1'
),
b
'
\xe4\xf6\xfc
'
)
...
...
@@ -1614,12 +1608,6 @@ class CodecsModuleTest(unittest.TestCase):
self
.
assertEqual
(
codecs
.
encode
(
'abc'
),
b
'abc'
)
self
.
assertRaises
(
UnicodeEncodeError
,
codecs
.
encode
,
'
\xff
ff'
,
'ascii'
)
# test keywords
self
.
assertEqual
(
codecs
.
encode
(
obj
=
'
\xe4\xf6\xfc
'
,
encoding
=
'latin-1'
),
b
'
\xe4\xf6\xfc
'
)
self
.
assertEqual
(
codecs
.
encode
(
'[
\xff
]'
,
'ascii'
,
errors
=
'ignore'
),
b
'[]'
)
def
test_register
(
self
):
self
.
assertRaises
(
TypeError
,
codecs
.
register
)
self
.
assertRaises
(
TypeError
,
codecs
.
register
,
42
)
...
...
Modules/_codecsmodule.c
Dosyayı görüntüle @
e1e04ad8
...
...
@@ -89,15 +89,13 @@ a ValueError. Other possible values are 'ignore', 'replace' and\n\
codecs.register_error that can handle ValueErrors."
);
static
PyObject
*
codec_encode
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
codec_encode
(
PyObject
*
self
,
PyObject
*
args
)
{
static
char
*
kwlist
[]
=
{
"obj"
,
"encoding"
,
"errors"
,
NULL
};
const
char
*
encoding
=
NULL
;
const
char
*
errors
=
NULL
;
PyObject
*
v
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O|ss:encode"
,
kwlist
,
&
v
,
&
encoding
,
&
errors
))
if
(
!
PyArg_ParseTuple
(
args
,
"O|ss:encode"
,
&
v
,
&
encoding
,
&
errors
))
return
NULL
;
if
(
encoding
==
NULL
)
...
...
@@ -118,15 +116,13 @@ as well as any other name registered with codecs.register_error that is\n\
able to handle ValueErrors."
);
static
PyObject
*
codec_decode
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
codec_decode
(
PyObject
*
self
,
PyObject
*
args
)
{
static
char
*
kwlist
[]
=
{
"obj"
,
"encoding"
,
"errors"
,
NULL
};
const
char
*
encoding
=
NULL
;
const
char
*
errors
=
NULL
;
PyObject
*
v
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O|ss:decode"
,
kwlist
,
&
v
,
&
encoding
,
&
errors
))
if
(
!
PyArg_ParseTuple
(
args
,
"O|ss:decode"
,
&
v
,
&
encoding
,
&
errors
))
return
NULL
;
if
(
encoding
==
NULL
)
...
...
@@ -1124,9 +1120,9 @@ static PyMethodDef _codecs_functions[] = {
register__doc__
},
{
"lookup"
,
codec_lookup
,
METH_VARARGS
,
lookup__doc__
},
{
"encode"
,
(
PyCFunction
)
codec_encode
,
METH_VARARGS
|
METH_KEYWORD
S
,
{
"encode"
,
codec_encode
,
METH_VARARG
S
,
encode__doc__
},
{
"decode"
,
(
PyCFunction
)
codec_decode
,
METH_VARARGS
|
METH_KEYWORD
S
,
{
"decode"
,
codec_decode
,
METH_VARARG
S
,
decode__doc__
},
{
"escape_encode"
,
escape_encode
,
METH_VARARGS
},
{
"escape_decode"
,
escape_decode
,
METH_VARARGS
},
...
...
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