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
034b0acd
Kaydet (Commit)
034b0acd
authored
Nis 05, 2010
tarafından
Philip Jenvey
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix escape_encode to return the correct consumed size
üst
dd194ab3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
test_codecs.py
Lib/test/test_codecs.py
+3
-0
_codecsmodule.c
Modules/_codecsmodule.c
+5
-4
No files found.
Lib/test/test_codecs.py
Dosyayı görüntüle @
034b0acd
...
@@ -835,6 +835,9 @@ class UnicodeInternalTest(unittest.TestCase):
...
@@ -835,6 +835,9 @@ class UnicodeInternalTest(unittest.TestCase):
self
.
assertEquals
(
encoder
(
u"a"
)[
1
],
1
)
self
.
assertEquals
(
encoder
(
u"a"
)[
1
],
1
)
self
.
assertEquals
(
encoder
(
u"
\xe9\u0142
"
)[
1
],
2
)
self
.
assertEquals
(
encoder
(
u"
\xe9\u0142
"
)[
1
],
2
)
encoder
=
codecs
.
getencoder
(
"string-escape"
)
self
.
assertEquals
(
encoder
(
r'\x00'
)[
1
],
4
)
# From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
# From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
nameprep_tests
=
[
nameprep_tests
=
[
# 3.1 Map to nothing.
# 3.1 Map to nothing.
...
...
Modules/_codecsmodule.c
Dosyayı görüntüle @
034b0acd
...
@@ -179,12 +179,13 @@ escape_encode(PyObject *self,
...
@@ -179,12 +179,13 @@ escape_encode(PyObject *self,
PyObject
*
str
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
const
char
*
errors
=
NULL
;
char
*
buf
;
char
*
buf
;
Py_ssize_t
len
;
Py_ssize_t
consumed
,
len
;
if
(
!
PyArg_ParseTuple
(
args
,
"
O!
|z:escape_encode"
,
if
(
!
PyArg_ParseTuple
(
args
,
"
S
|z:escape_encode"
,
&
PyString_Type
,
&
str
,
&
errors
))
&
str
,
&
errors
))
return
NULL
;
return
NULL
;
consumed
=
PyString_GET_SIZE
(
str
);
str
=
PyString_Repr
(
str
,
0
);
str
=
PyString_Repr
(
str
,
0
);
if
(
!
str
)
if
(
!
str
)
return
NULL
;
return
NULL
;
...
@@ -196,7 +197,7 @@ escape_encode(PyObject *self,
...
@@ -196,7 +197,7 @@ escape_encode(PyObject *self,
if
(
_PyString_Resize
(
&
str
,
len
-
2
)
<
0
)
if
(
_PyString_Resize
(
&
str
,
len
-
2
)
<
0
)
return
NULL
;
return
NULL
;
return
codec_tuple
(
str
,
PyString_Size
(
str
)
);
return
codec_tuple
(
str
,
consumed
);
}
}
#ifdef Py_USING_UNICODE
#ifdef Py_USING_UNICODE
...
...
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