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
ab0d8a1f
Kaydet (Commit)
ab0d8a1f
authored
Mar 17, 2008
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
zlib.crc32 and zlib.adler32 now return an unsigned value as any sane person
would expect. Fixes issues1202.
üst
c55485bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
zlib.rst
Doc/library/zlib.rst
+4
-0
test_zlib.py
Lib/test/test_zlib.py
+8
-0
zlibmodule.c
Modules/zlibmodule.c
+2
-2
No files found.
Doc/library/zlib.rst
Dosyayı görüntüle @
ab0d8a1f
...
...
@@ -42,6 +42,8 @@ The available exception and functions in this module are:
the algorithm is designed for use as a checksum algorithm, it is not suitable
for use as a general hash algorithm.
Always returns an unsigned 32-bit integer.
.. function:: compress(string[, level])
...
...
@@ -74,6 +76,8 @@ The available exception and functions in this module are:
the algorithm is designed for use as a checksum algorithm, it is not suitable
for use as a general hash algorithm.
Always returns an unsigned 32-bit integer.
.. function:: decompress(string[, wbits[, bufsize]])
...
...
Lib/test/test_zlib.py
Dosyayı görüntüle @
ab0d8a1f
...
...
@@ -38,6 +38,14 @@ class ChecksumTestCase(unittest.TestCase):
self
.
assertEqual
(
zlib
.
crc32
(
b
"penguin"
),
zlib
.
crc32
(
b
"penguin"
,
0
))
self
.
assertEqual
(
zlib
.
adler32
(
b
"penguin"
),
zlib
.
adler32
(
b
"penguin"
,
1
))
def
test_crc32_adler32_unsigned
(
self
):
foo
=
'abcdefghijklmnop'
# explicitly test signed behavior
self
.
assertEqual
(
zlib
.
crc32
(
foo
),
2486878355
)
self
.
assertEqual
(
zlib
.
crc32
(
'spam'
),
1138425661
)
self
.
assertEqual
(
zlib
.
adler32
(
foo
+
foo
),
3573550353
)
self
.
assertEqual
(
zlib
.
adler32
(
'spam'
),
72286642
)
class
ExceptionTestCase
(
unittest
.
TestCase
):
...
...
Modules/zlibmodule.c
Dosyayı görüntüle @
ab0d8a1f
...
...
@@ -922,7 +922,7 @@ PyZlib_adler32(PyObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"s#|k:adler32"
,
&
buf
,
&
len
,
&
adler32val
))
return
NULL
;
adler32val
=
adler32
(
adler32val
,
buf
,
len
);
return
PyLong_From
Long
(
adler32val
);
return
PyLong_From
UnsignedLong
(
adler32val
&
0xffffffff
);
}
PyDoc_STRVAR
(
crc32__doc__
,
...
...
@@ -940,7 +940,7 @@ PyZlib_crc32(PyObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"s#|k:crc32"
,
&
buf
,
&
len
,
&
crc32val
))
return
NULL
;
crc32val
=
crc32
(
crc32val
,
buf
,
len
);
return
PyLong_From
Long
(
crc32val
);
return
PyLong_From
UnsignedLong
(
crc32val
&
0xffffffff
);
}
...
...
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