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
2c9838e3
Kaydet (Commit)
2c9838e3
authored
Eki 29, 2006
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders.
üst
5b4e1c25
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
8 deletions
+55
-8
bz2_codec.py
Lib/encodings/bz2_codec.py
+25
-4
zlib_codec.py
Lib/encodings/zlib_codec.py
+26
-4
test_codecs.py
Lib/test/test_codecs.py
+2
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/encodings/bz2_codec.py
Dosyayı görüntüle @
2c9838e3
...
...
@@ -52,14 +52,35 @@ class Codec(codecs.Codec):
return
bz2_decode
(
input
,
errors
)
class
IncrementalEncoder
(
codecs
.
IncrementalEncoder
):
def
__init__
(
self
,
errors
=
'strict'
):
assert
errors
==
'strict'
self
.
errors
=
errors
self
.
compressobj
=
bz2
.
BZ2Compressor
()
def
encode
(
self
,
input
,
final
=
False
):
assert
self
.
errors
==
'strict'
return
bz2
.
compress
(
input
)
if
final
:
c
=
self
.
compressobj
.
compress
(
input
)
return
c
+
self
.
compressobj
.
flush
()
else
:
return
self
.
compressobj
.
compress
(
input
)
def
reset
(
self
):
self
.
compressobj
=
bz2
.
BZ2Compressor
()
class
IncrementalDecoder
(
codecs
.
IncrementalDecoder
):
def
__init__
(
self
,
errors
=
'strict'
):
assert
errors
==
'strict'
self
.
errors
=
errors
self
.
decompressobj
=
bz2
.
BZ2Decompressor
()
def
decode
(
self
,
input
,
final
=
False
):
assert
self
.
errors
==
'strict'
return
bz2
.
decompress
(
input
)
try
:
return
self
.
decompressobj
.
decompress
(
input
)
except
EOFError
:
return
''
def
reset
(
self
):
self
.
decompressobj
=
bz2
.
BZ2Decompressor
()
class
StreamWriter
(
Codec
,
codecs
.
StreamWriter
):
pass
...
...
Lib/encodings/zlib_codec.py
Dosyayı görüntüle @
2c9838e3
...
...
@@ -51,14 +51,36 @@ class Codec(codecs.Codec):
return
zlib_decode
(
input
,
errors
)
class
IncrementalEncoder
(
codecs
.
IncrementalEncoder
):
def
__init__
(
self
,
errors
=
'strict'
):
assert
errors
==
'strict'
self
.
errors
=
errors
self
.
compressobj
=
zlib
.
compressobj
()
def
encode
(
self
,
input
,
final
=
False
):
assert
self
.
errors
==
'strict'
return
zlib
.
compress
(
input
)
if
final
:
c
=
self
.
compressobj
.
compress
(
input
)
return
c
+
self
.
compressobj
.
flush
()
else
:
return
self
.
compressobj
.
compress
(
input
)
def
reset
(
self
):
self
.
compressobj
=
zlib
.
compressobj
()
class
IncrementalDecoder
(
codecs
.
IncrementalDecoder
):
def
__init__
(
self
,
errors
=
'strict'
):
assert
errors
==
'strict'
self
.
errors
=
errors
self
.
decompressobj
=
zlib
.
decompressobj
()
def
decode
(
self
,
input
,
final
=
False
):
assert
self
.
errors
==
'strict'
return
zlib
.
decompress
(
input
)
if
final
:
c
=
self
.
decompressobj
.
decompress
(
input
)
return
c
+
self
.
decompressobj
.
flush
()
else
:
return
self
.
decompressobj
.
decompress
(
input
)
def
reset
(
self
):
self
.
decompressobj
=
zlib
.
decompressobj
()
class
StreamWriter
(
Codec
,
codecs
.
StreamWriter
):
pass
...
...
Lib/test/test_codecs.py
Dosyayı görüntüle @
2c9838e3
...
...
@@ -1062,6 +1062,7 @@ broken_unicode_with_streams = [
"punycode"
,
"unicode_internal"
]
broken_incremental_coders
=
broken_unicode_with_streams
[:]
try
:
import
bz2
...
...
@@ -1111,6 +1112,7 @@ class BasicUnicodeTest(unittest.TestCase):
decodedresult
+=
reader
.
read
()
self
.
assertEqual
(
decodedresult
,
s
,
"
%
r !=
%
r (encoding=
%
r)"
%
(
decodedresult
,
s
,
encoding
))
if
encoding
not
in
broken_incremental_coders
:
# check incremental decoder/encoder (fetched via the Python
# and C API) and iterencode()/iterdecode()
try
:
...
...
Misc/NEWS
Dosyayı görüntüle @
2c9838e3
...
...
@@ -89,6 +89,8 @@ Core and builtins
Library
-------
-
Bug
#
1586613
:
fix
zlib
and
bz2
codecs
' incremental en/decoders.
- Patch #1583880: fix tarfile'
s
problems
with
long
names
and
posix
/
GNU
modes
.
...
...
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