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
4bbcb64d
Kaydet (Commit)
4bbcb64d
authored
Nis 02, 2007
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF #1693079 Array module cannot pickle empty arrays
üst
93e93844
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
test_array.py
Lib/test/test_array.py
+15
-0
NEWS
Misc/NEWS
+2
-0
arraymodule.c
Modules/arraymodule.c
+13
-6
No files found.
Lib/test/test_array.py
Dosyayı görüntüle @
4bbcb64d
...
...
@@ -111,6 +111,21 @@ class BaseTest(unittest.TestCase):
self
.
assertEqual
(
a
.
x
,
b
.
x
)
self
.
assertEqual
(
type
(
a
),
type
(
b
))
def
test_pickle_for_empty_array
(
self
):
for
protocol
in
(
0
,
1
,
2
):
a
=
array
.
array
(
self
.
typecode
)
b
=
loads
(
dumps
(
a
,
protocol
))
self
.
assertNotEqual
(
id
(
a
),
id
(
b
))
self
.
assertEqual
(
a
,
b
)
a
=
ArraySubclass
(
self
.
typecode
)
a
.
x
=
10
b
=
loads
(
dumps
(
a
,
protocol
))
self
.
assertNotEqual
(
id
(
a
),
id
(
b
))
self
.
assertEqual
(
a
,
b
)
self
.
assertEqual
(
a
.
x
,
b
.
x
)
self
.
assertEqual
(
type
(
a
),
type
(
b
))
def
test_insert
(
self
):
a
=
array
.
array
(
self
.
typecode
,
self
.
example
)
a
.
insert
(
0
,
self
.
example
[
0
])
...
...
Misc/NEWS
Dosyayı görüntüle @
4bbcb64d
...
...
@@ -134,6 +134,8 @@ Core and builtins
Extension
Modules
-----------------
-
Bug
#
1693079
:
The
array
module
can
now
successfully
pickle
empty
arrays
.
-
Bug
#
1688393
:
Prevent
crash
in
socket
.
recvfrom
if
length
is
negative
.
-
Bug
#
1622896
:
fix
a
rare
corner
case
where
the
bz2
module
raised
an
...
...
Modules/arraymodule.c
Dosyayı görüntüle @
4bbcb64d
...
...
@@ -1147,12 +1147,19 @@ array_reduce(arrayobject *array)
dict
=
Py_None
;
Py_INCREF
(
dict
);
}
result
=
Py_BuildValue
(
"O(cs#)O"
,
array
->
ob_type
,
array
->
ob_descr
->
typecode
,
array
->
ob_item
,
array
->
ob_size
*
array
->
ob_descr
->
itemsize
,
dict
);
if
(
array
->
ob_size
>
0
)
{
result
=
Py_BuildValue
(
"O(cs#)O"
,
array
->
ob_type
,
array
->
ob_descr
->
typecode
,
array
->
ob_item
,
array
->
ob_size
*
array
->
ob_descr
->
itemsize
,
dict
);
}
else
{
result
=
Py_BuildValue
(
"O(c)O"
,
array
->
ob_type
,
array
->
ob_descr
->
typecode
,
dict
);
}
Py_DECREF
(
dict
);
return
result
;
}
...
...
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