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
28d271ef
Kaydet (Commit)
28d271ef
authored
Ara 02, 2013
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19754: Make pickletools.optimize respect the frame size target.
üst
53dd8167
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
14 deletions
+2
-14
pickletools.py
Lib/pickletools.py
+1
-0
pickletester.py
Lib/test/pickletester.py
+1
-12
test_pickletools.py
Lib/test/test_pickletools.py
+0
-2
No files found.
Lib/pickletools.py
Dosyayı görüntüle @
28d271ef
...
@@ -2313,6 +2313,7 @@ def optimize(p):
...
@@ -2313,6 +2313,7 @@ def optimize(p):
buf
.
start_framing
()
buf
.
start_framing
()
for
start
,
stop
,
putid
in
opcodes
:
for
start
,
stop
,
putid
in
opcodes
:
if
putid
in
gets
:
if
putid
in
gets
:
#buf.commit_frame()
buf
.
write
(
p
[
start
:
stop
])
buf
.
write
(
p
[
start
:
stop
])
if
proto
>=
4
:
if
proto
>=
4
:
buf
.
end_framing
()
buf
.
end_framing
()
...
...
Lib/test/pickletester.py
Dosyayı görüntüle @
28d271ef
...
@@ -1343,12 +1343,6 @@ class AbstractPickleTests(unittest.TestCase):
...
@@ -1343,12 +1343,6 @@ class AbstractPickleTests(unittest.TestCase):
pickled
=
self
.
dumps
(
obj
,
proto
)
pickled
=
self
.
dumps
(
obj
,
proto
)
unpickled
=
self
.
loads
(
pickled
)
unpickled
=
self
.
loads
(
pickled
)
self
.
assertEqual
(
obj
,
unpickled
)
self
.
assertEqual
(
obj
,
unpickled
)
# Test the framing heuristic is sane,
# assuming a given frame size target.
if
self
.
optimized
:
# These assumptions are currently invalid for optimized
# pickles (see e.g. issue19754).
continue
bytes_per_frame
=
(
len
(
pickled
)
/
bytes_per_frame
=
(
len
(
pickled
)
/
count_opcode
(
pickle
.
FRAME
,
pickled
))
count_opcode
(
pickle
.
FRAME
,
pickled
))
self
.
assertGreater
(
bytes_per_frame
,
self
.
assertGreater
(
bytes_per_frame
,
...
@@ -1365,12 +1359,7 @@ class AbstractPickleTests(unittest.TestCase):
...
@@ -1365,12 +1359,7 @@ class AbstractPickleTests(unittest.TestCase):
unpickled
=
self
.
loads
(
pickled
)
unpickled
=
self
.
loads
(
pickled
)
self
.
assertEqual
(
obj
,
unpickled
)
self
.
assertEqual
(
obj
,
unpickled
)
n_frames
=
count_opcode
(
pickle
.
FRAME
,
pickled
)
n_frames
=
count_opcode
(
pickle
.
FRAME
,
pickled
)
if
self
.
optimized
:
self
.
assertGreaterEqual
(
n_frames
,
len
(
obj
))
# At least one frame was emitted (see issue19754).
self
.
assertGreaterEqual
(
n_frames
,
1
)
else
:
# At least one frame was emitted per large bytes object.
self
.
assertGreaterEqual
(
n_frames
,
len
(
obj
))
def
test_optional_frames
(
self
):
def
test_optional_frames
(
self
):
if
pickle
.
HIGHEST_PROTOCOL
<
4
:
if
pickle
.
HIGHEST_PROTOCOL
<
4
:
...
...
Lib/test/test_pickletools.py
Dosyayı görüntüle @
28d271ef
...
@@ -6,8 +6,6 @@ from test.pickletester import AbstractPickleModuleTests
...
@@ -6,8 +6,6 @@ from test.pickletester import AbstractPickleModuleTests
class
OptimizedPickleTests
(
AbstractPickleTests
,
AbstractPickleModuleTests
):
class
OptimizedPickleTests
(
AbstractPickleTests
,
AbstractPickleModuleTests
):
optimized
=
True
def
dumps
(
self
,
arg
,
proto
=
None
):
def
dumps
(
self
,
arg
,
proto
=
None
):
return
pickletools
.
optimize
(
pickle
.
dumps
(
arg
,
proto
))
return
pickletools
.
optimize
(
pickle
.
dumps
(
arg
,
proto
))
...
...
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