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
54af41d4
Kaydet (Commit)
54af41d4
authored
May 22, 2017
tarafından
Xiang Zhang
Kaydeden (comit)
GitHub
May 22, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-30003: Fix handling escape characters in HZ codec (#1556) (#1719)
üst
0702cc01
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
test_codecencodings_cn.py
Lib/test/test_codecencodings_cn.py
+4
-0
NEWS
Misc/NEWS
+3
-0
_codecs_cn.c
Modules/cjkcodecs/_codecs_cn.c
+12
-13
No files found.
Lib/test/test_codecencodings_cn.py
Dosyayı görüntüle @
54af41d4
...
@@ -86,6 +86,10 @@ class Test_HZ(multibytecodec_support.TestBase, unittest.TestCase):
...
@@ -86,6 +86,10 @@ class Test_HZ(multibytecodec_support.TestBase, unittest.TestCase):
(
b
'ab~{
\x81\x81\x41\x44
~}cd'
,
'replace'
,
'ab
\uFFFD\uFFFD\u804A
cd'
),
(
b
'ab~{
\x81\x81\x41\x44
~}cd'
,
'replace'
,
'ab
\uFFFD\uFFFD\u804A
cd'
),
(
b
'ab~{
\x41\x44
~}cd'
,
'replace'
,
'ab
\u804A
cd'
),
(
b
'ab~{
\x41\x44
~}cd'
,
'replace'
,
'ab
\u804A
cd'
),
(
b
"ab~{
\x79\x79\x41\x44
~}cd"
,
"replace"
,
"ab
\ufffd\ufffd\u804a
cd"
),
(
b
"ab~{
\x79\x79\x41\x44
~}cd"
,
"replace"
,
"ab
\ufffd\ufffd\u804a
cd"
),
# issue 30003
(
'ab~cd'
,
'strict'
,
b
'ab~~cd'
),
# escape ~
(
b
'~{Dc~~:C~}'
,
'strict'
,
None
),
# ~~ only in ASCII mode
(
b
'~{Dc~
\n
:C~}'
,
'strict'
,
None
),
# ~\n only in ASCII mode
)
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Misc/NEWS
Dosyayı görüntüle @
54af41d4
...
@@ -43,6 +43,9 @@ Core and Builtins
...
@@ -43,6 +43,9 @@ Core and Builtins
Library
Library
-------
-------
- bpo-30003: Fix handling escape characters in HZ codec. Based on patch
by Ma Lin.
- bpo-30301: Fix AttributeError when using SimpleQueue.empty() under
- bpo-30301: Fix AttributeError when using SimpleQueue.empty() under
*spawn* and *forkserver* start methods.
*spawn* and *forkserver* start methods.
...
...
Modules/cjkcodecs/_codecs_cn.c
Dosyayı görüntüle @
54af41d4
...
@@ -350,15 +350,17 @@ ENCODER(hz)
...
@@ -350,15 +350,17 @@ ENCODER(hz)
DBCHAR
code
;
DBCHAR
code
;
if
(
c
<
0x80
)
{
if
(
c
<
0x80
)
{
if
(
state
->
i
==
0
)
{
if
(
state
->
i
)
{
WRITEBYTE1
((
unsigned
char
)
c
);
WRITEBYTE2
(
'~'
,
'}'
);
NEXT
(
1
,
1
);
NEXT_OUT
(
2
);
}
else
{
WRITEBYTE3
(
'~'
,
'}'
,
(
unsigned
char
)
c
);
NEXT
(
1
,
3
);
state
->
i
=
0
;
state
->
i
=
0
;
}
}
WRITEBYTE1
((
unsigned
char
)
c
);
NEXT
(
1
,
1
);
if
(
c
==
'~'
)
{
WRITEBYTE1
(
'~'
);
NEXT_OUT
(
1
);
}
continue
;
continue
;
}
}
...
@@ -409,17 +411,14 @@ DECODER(hz)
...
@@ -409,17 +411,14 @@ DECODER(hz)
unsigned
char
c2
=
INBYTE2
;
unsigned
char
c2
=
INBYTE2
;
REQUIRE_INBUF
(
2
);
REQUIRE_INBUF
(
2
);
if
(
c2
==
'~'
)
{
if
(
c2
==
'~'
&&
state
->
i
==
0
)
OUTCHAR
(
'~'
);
OUTCHAR
(
'~'
);
NEXT_IN
(
2
);
continue
;
}
else
if
(
c2
==
'{'
&&
state
->
i
==
0
)
else
if
(
c2
==
'{'
&&
state
->
i
==
0
)
state
->
i
=
1
;
/* set GB */
state
->
i
=
1
;
/* set GB */
else
if
(
c2
==
'\n'
&&
state
->
i
==
0
)
;
/* line-continuation */
else
if
(
c2
==
'}'
&&
state
->
i
==
1
)
else
if
(
c2
==
'}'
&&
state
->
i
==
1
)
state
->
i
=
0
;
/* set ASCII */
state
->
i
=
0
;
/* set ASCII */
else
if
(
c2
==
'\n'
)
;
/* line-continuation */
else
else
return
1
;
return
1
;
NEXT_IN
(
2
);
NEXT_IN
(
2
);
...
...
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