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
cdc7a91d
Kaydet (Commit)
cdc7a91d
authored
Şub 12, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13555: cPickle now supports files larger than 2 GiB.
üst
da5c2a06
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
12 deletions
+65
-12
pickletester.py
Lib/test/pickletester.py
+30
-1
test_cpickle.py
Lib/test/test_cpickle.py
+15
-2
test_pickle.py
Lib/test/test_pickle.py
+16
-4
NEWS
Misc/NEWS
+2
-0
cPickle.c
Modules/cPickle.c
+0
-0
cStringIO.c
Modules/cStringIO.c
+2
-5
No files found.
Lib/test/pickletester.py
Dosyayı görüntüle @
cdc7a91d
...
...
@@ -6,7 +6,8 @@ import cStringIO
import
pickletools
import
copy_reg
from
test.test_support
import
TestFailed
,
have_unicode
,
TESTFN
from
test.test_support
import
(
TestFailed
,
have_unicode
,
TESTFN
,
_2G
,
_1M
,
precisionbigmemtest
)
# Tests that try a number of pickle protocols should have a
# for proto in protocols:
...
...
@@ -1280,3 +1281,31 @@ class AbstractPicklerUnpicklerObjectTests(unittest.TestCase):
f
.
write
(
pickled2
)
f
.
seek
(
0
)
self
.
assertEqual
(
unpickler
.
load
(),
data2
)
class
BigmemPickleTests
(
unittest
.
TestCase
):
# Memory requirements: 1 byte per character for input strings, 1 byte
# for pickled data, 1 byte for unpickled strings, 1 byte for internal
# buffer and 1 byte of free space for resizing of internal buffer.
@precisionbigmemtest
(
size
=
_2G
+
100
*
_1M
,
memuse
=
5
)
def
test_huge_strlist
(
self
,
size
):
chunksize
=
2
**
20
data
=
[]
while
size
>
chunksize
:
data
.
append
(
'x'
*
chunksize
)
size
-=
chunksize
chunksize
+=
1
data
.
append
(
'y'
*
size
)
try
:
for
proto
in
protocols
:
try
:
pickled
=
self
.
dumps
(
data
,
proto
)
res
=
self
.
loads
(
pickled
)
self
.
assertEqual
(
res
,
data
)
finally
:
res
=
None
pickled
=
None
finally
:
data
=
None
Lib/test/test_cpickle.py
Dosyayı görüntüle @
cdc7a91d
import
cPickle
,
unittest
from
cStringIO
import
StringIO
from
test.pickletester
import
AbstractPickleTests
,
AbstractPickleModuleTests
from
test.pickletester
import
AbstractPicklerUnpicklerObjectTests
from
test.pickletester
import
(
AbstractPickleTests
,
AbstractPickleModuleTests
,
AbstractPicklerUnpicklerObjectTests
,
BigmemPickleTests
)
from
test
import
test_support
class
cPickleTests
(
AbstractPickleTests
,
AbstractPickleModuleTests
):
...
...
@@ -101,6 +103,16 @@ class cPicklePicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests):
pickler_class
=
cPickle
.
Pickler
unpickler_class
=
cPickle
.
Unpickler
class
cPickleBigmemPickleTests
(
BigmemPickleTests
):
def
dumps
(
self
,
arg
,
proto
=
0
,
fast
=
0
):
# Ignore fast
return
cPickle
.
dumps
(
arg
,
proto
)
def
loads
(
self
,
buf
):
# Ignore fast
return
cPickle
.
loads
(
buf
)
class
Node
(
object
):
pass
...
...
@@ -133,6 +145,7 @@ def test_main():
cPickleFastPicklerTests
,
cPickleDeepRecursive
,
cPicklePicklerUnpicklerObjectTests
,
cPickleBigmemPickleTests
,
)
if
__name__
==
"__main__"
:
...
...
Lib/test/test_pickle.py
Dosyayı görüntüle @
cdc7a91d
...
...
@@ -3,10 +3,11 @@ from cStringIO import StringIO
from
test
import
test_support
from
test.pickletester
import
AbstractPickleTests
from
test.pickletester
import
AbstractPickleModuleTests
from
test.pickletester
import
AbstractPersistentPicklerTests
from
test.pickletester
import
AbstractPicklerUnpicklerObjectTests
from
test.pickletester
import
(
AbstractPickleTests
,
AbstractPickleModuleTests
,
AbstractPersistentPicklerTests
,
AbstractPicklerUnpicklerObjectTests
,
BigmemPickleTests
)
class
PickleTests
(
AbstractPickleTests
,
AbstractPickleModuleTests
):
...
...
@@ -66,6 +67,16 @@ class PicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests):
pickler_class
=
pickle
.
Pickler
unpickler_class
=
pickle
.
Unpickler
class
PickleBigmemPickleTests
(
BigmemPickleTests
):
def
dumps
(
self
,
arg
,
proto
=
0
,
fast
=
0
):
# Ignore fast
return
pickle
.
dumps
(
arg
,
proto
)
def
loads
(
self
,
buf
):
# Ignore fast
return
pickle
.
loads
(
buf
)
def
test_main
():
test_support
.
run_unittest
(
...
...
@@ -73,6 +84,7 @@ def test_main():
PicklerTests
,
PersPicklerTests
,
PicklerUnpicklerObjectTests
,
PickleBigmemPickleTests
,
)
test_support
.
run_doctest
(
pickle
)
...
...
Misc/NEWS
Dosyayı görüntüle @
cdc7a91d
...
...
@@ -202,6 +202,8 @@ Core and Builtins
Library
-------
- Issue #13555: cPickle now supports files larger than 2 GiB.
- Issue #17052: unittest discovery should use self.testLoader.
- Issue #4591: Uid and gid values larger than 2**31 are supported now.
...
...
Modules/cPickle.c
Dosyayı görüntüle @
cdc7a91d
This diff is collapsed.
Click to expand it.
Modules/cStringIO.c
Dosyayı görüntüle @
cdc7a91d
...
...
@@ -210,11 +210,8 @@ IO_creadline(PyObject *self, char **output) {
if
(
n
<
end
)
n
++
;
len
=
n
-
start
;
if
(
len
>
INT_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"length too large"
);
return
-
1
;
}
if
(
len
>
INT_MAX
)
len
=
INT_MAX
;
*
output
=
start
;
...
...
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