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
44bf631a
Kaydet (Commit)
44bf631a
authored
Ock 22, 2009
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Followup of #4874: also fix multibytecodec.c
üst
81fabdb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
test_multibytecodec.py
Lib/test/test_multibytecodec.py
+11
-1
multibytecodec.c
Modules/cjkcodecs/multibytecodec.c
+2
-2
No files found.
Lib/test/test_multibytecodec.py
Dosyayı görüntüle @
44bf631a
...
...
@@ -44,7 +44,7 @@ class Test_MultibyteCodec(unittest.TestCase):
myreplace
=
lambda
exc
:
(
''
,
sys
.
maxsize
+
1
)
codecs
.
register_error
(
'test.cjktest'
,
myreplace
)
self
.
assertRaises
(
IndexError
,
dec
,
'apple
\x92
ham
\x93
spam'
,
'test.cjktest'
)
b
'apple
\x92
ham
\x93
spam'
,
'test.cjktest'
)
def
test_codingspec
(
self
):
try
:
...
...
@@ -61,6 +61,10 @@ class Test_MultibyteCodec(unittest.TestCase):
self
.
assertRaises
(
AttributeError
,
_multibytecodec
.
MultibyteStreamWriter
,
None
)
def
test_decode_unicode
(
self
):
# Trying to decode an unicode string should raise a TypeError
for
enc
in
ALL_CJKENCODINGS
:
self
.
assertRaises
(
TypeError
,
codecs
.
getdecoder
(
enc
),
""
)
class
Test_IncrementalEncoder
(
unittest
.
TestCase
):
...
...
@@ -146,6 +150,12 @@ class Test_IncrementalDecoder(unittest.TestCase):
self
.
assertRaises
(
UnicodeDecodeError
,
decoder
.
decode
,
b
''
,
True
)
self
.
assertEqual
(
decoder
.
decode
(
b
'B@$'
),
'
\u4e16
'
)
def
test_decode_unicode
(
self
):
# Trying to decode an unicode string should raise a TypeError
for
enc
in
ALL_CJKENCODINGS
:
decoder
=
codecs
.
getincrementaldecoder
(
enc
)()
self
.
assertRaises
(
TypeError
,
decoder
.
decode
,
""
)
class
Test_StreamReader
(
unittest
.
TestCase
):
def
test_bug1728403
(
self
):
try
:
...
...
Modules/cjkcodecs/multibytecodec.c
Dosyayı görüntüle @
44bf631a
...
...
@@ -612,7 +612,7 @@ MultibyteCodec_Decode(MultibyteCodecObject *self,
const
char
*
data
,
*
errors
=
NULL
;
Py_ssize_t
datalen
,
finalsize
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"
s
*|z:decode"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"
y
*|z:decode"
,
codeckwarglist
,
&
pdata
,
&
errors
))
return
NULL
;
data
=
pdata
.
buf
;
...
...
@@ -1038,7 +1038,7 @@ mbidecoder_decode(MultibyteIncrementalDecoderObject *self,
Py_ssize_t
wsize
,
finalsize
=
0
,
size
,
origpending
;
int
final
=
0
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"
s
*|i:decode"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"
y
*|i:decode"
,
incrementalkwarglist
,
&
pdata
,
&
final
))
return
NULL
;
data
=
pdata
.
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