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
6c02916d
Kaydet (Commit)
6c02916d
authored
May 11, 2008
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
üst
ab756f60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
test_marshal.py
Lib/test/test_marshal.py
+8
-0
marshal.c
Python/marshal.c
+4
-1
No files found.
Lib/test/test_marshal.py
Dosyayı görüntüle @
6c02916d
...
@@ -255,6 +255,14 @@ class BugsTestCase(unittest.TestCase):
...
@@ -255,6 +255,14 @@ class BugsTestCase(unittest.TestCase):
subtyp
=
type
(
'subtyp'
,
(
typ
,),
{})
subtyp
=
type
(
'subtyp'
,
(
typ
,),
{})
self
.
assertRaises
(
ValueError
,
marshal
.
dumps
,
subtyp
())
self
.
assertRaises
(
ValueError
,
marshal
.
dumps
,
subtyp
())
# Issue #1792 introduced a change in how marshal increases the size of its
# internal buffer; this test ensures that the new code is exercised.
def
test_large_marshal
(
self
):
size
=
int
(
1e6
)
testString
=
'abc'
*
size
marshal
.
dumps
(
testString
)
def
test_main
():
def
test_main
():
test_support
.
run_unittest
(
IntTestCase
,
test_support
.
run_unittest
(
IntTestCase
,
FloatTestCase
,
FloatTestCase
,
...
...
Python/marshal.c
Dosyayı görüntüle @
6c02916d
...
@@ -65,7 +65,10 @@ w_more(int c, WFILE *p)
...
@@ -65,7 +65,10 @@ w_more(int c, WFILE *p)
if
(
p
->
str
==
NULL
)
if
(
p
->
str
==
NULL
)
return
;
/* An error already occurred */
return
;
/* An error already occurred */
size
=
PyString_Size
(
p
->
str
);
size
=
PyString_Size
(
p
->
str
);
newsize
=
size
+
1024
;
newsize
=
size
+
size
+
1024
;
if
(
newsize
>
32
*
1024
*
1024
)
{
newsize
=
size
+
1024
*
1024
;
}
if
(
_PyString_Resize
(
&
p
->
str
,
newsize
)
!=
0
)
{
if
(
_PyString_Resize
(
&
p
->
str
,
newsize
)
!=
0
)
{
p
->
ptr
=
p
->
end
=
NULL
;
p
->
ptr
=
p
->
end
=
NULL
;
}
}
...
...
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