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
f3078fbe
Kaydet (Commit)
f3078fbe
authored
Mar 12, 2012
tarafından
Łukasz Langa
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixes #13842: cannot pickle Ellipsis or NotImplemented.
Thanks for James Sanders for the bug report and the patch.
üst
e976fc74
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
0 deletions
+42
-0
pickle.py
Lib/pickle.py
+8
-0
pickletester.py
Lib/test/pickletester.py
+12
-0
ACKS
Misc/ACKS
+1
-0
_pickle.c
Modules/_pickle.c
+21
-0
No files found.
Lib/pickle.py
Dosyayı görüntüle @
f3078fbe
...
@@ -438,6 +438,14 @@ class _Pickler:
...
@@ -438,6 +438,14 @@ class _Pickler:
self
.
write
(
NONE
)
self
.
write
(
NONE
)
dispatch
[
type
(
None
)]
=
save_none
dispatch
[
type
(
None
)]
=
save_none
def
save_ellipsis
(
self
,
obj
):
self
.
save_global
(
Ellipsis
,
'Ellipsis'
)
dispatch
[
type
(
Ellipsis
)]
=
save_ellipsis
def
save_notimplemented
(
self
,
obj
):
self
.
save_global
(
NotImplemented
,
'NotImplemented'
)
dispatch
[
type
(
NotImplemented
)]
=
save_notimplemented
def
save_bool
(
self
,
obj
):
def
save_bool
(
self
,
obj
):
if
self
.
proto
>=
2
:
if
self
.
proto
>=
2
:
self
.
write
(
obj
and
NEWTRUE
or
NEWFALSE
)
self
.
write
(
obj
and
NEWTRUE
or
NEWFALSE
)
...
...
Lib/test/pickletester.py
Dosyayı görüntüle @
f3078fbe
...
@@ -743,6 +743,18 @@ class AbstractPickleTests(unittest.TestCase):
...
@@ -743,6 +743,18 @@ class AbstractPickleTests(unittest.TestCase):
u
=
self
.
loads
(
s
)
u
=
self
.
loads
(
s
)
self
.
assertEqual
(
t
,
u
)
self
.
assertEqual
(
t
,
u
)
def
test_ellipsis
(
self
):
for
proto
in
protocols
:
s
=
self
.
dumps
(
...
,
proto
)
u
=
self
.
loads
(
s
)
self
.
assertEqual
(
...
,
u
)
def
test_notimplemented
(
self
):
for
proto
in
protocols
:
s
=
self
.
dumps
(
NotImplemented
,
proto
)
u
=
self
.
loads
(
s
)
self
.
assertEqual
(
NotImplemented
,
u
)
# Tests for protocol 2
# Tests for protocol 2
def
test_proto
(
self
):
def
test_proto
(
self
):
...
...
Misc/ACKS
Dosyayı görüntüle @
f3078fbe
...
@@ -883,6 +883,7 @@ George Sakkis
...
@@ -883,6 +883,7 @@ George Sakkis
Rich Salz
Rich Salz
Kevin Samborn
Kevin Samborn
Adrian Sampson
Adrian Sampson
James Sanders
Ilya Sandler
Ilya Sandler
Mark Sapiro
Mark Sapiro
Ty Sarna
Ty Sarna
...
...
Modules/_pickle.c
Dosyayı görüntüle @
f3078fbe
...
@@ -2811,6 +2811,19 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
...
@@ -2811,6 +2811,19 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
return
status
;
return
status
;
}
}
static
int
save_ellipsis
(
PicklerObject
*
self
,
PyObject
*
obj
)
{
return
save_global
(
self
,
Py_Ellipsis
,
PyUnicode_FromString
(
"Ellipsis"
));
}
static
int
save_notimplemented
(
PicklerObject
*
self
,
PyObject
*
obj
)
{
return
save_global
(
self
,
Py_NotImplemented
,
PyUnicode_FromString
(
"NotImplemented"
));
}
static
int
static
int
save_pers
(
PicklerObject
*
self
,
PyObject
*
obj
,
PyObject
*
func
)
save_pers
(
PicklerObject
*
self
,
PyObject
*
obj
,
PyObject
*
func
)
{
{
...
@@ -3114,6 +3127,14 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
...
@@ -3114,6 +3127,14 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
status
=
save_none
(
self
,
obj
);
status
=
save_none
(
self
,
obj
);
goto
done
;
goto
done
;
}
}
else
if
(
obj
==
Py_Ellipsis
)
{
status
=
save_ellipsis
(
self
,
obj
);
goto
done
;
}
else
if
(
obj
==
Py_NotImplemented
)
{
status
=
save_notimplemented
(
self
,
obj
);
goto
done
;
}
else
if
(
obj
==
Py_False
||
obj
==
Py_True
)
{
else
if
(
obj
==
Py_False
||
obj
==
Py_True
)
{
status
=
save_bool
(
self
,
obj
);
status
=
save_bool
(
self
,
obj
);
goto
done
;
goto
done
;
...
...
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