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
c49477b1
Kaydet (Commit)
c49477b1
authored
Kas 24, 2013
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make Ellipsis and NotImplemented picklable through the reduce protocol.
üst
4c05d3bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
42 deletions
+24
-42
pickle.py
Lib/pickle.py
+0
-8
_pickle.c
Modules/_pickle.c
+0
-32
object.c
Objects/object.c
+12
-1
sliceobject.c
Objects/sliceobject.c
+12
-1
No files found.
Lib/pickle.py
Dosyayı görüntüle @
c49477b1
...
...
@@ -633,14 +633,6 @@ class _Pickler:
self
.
write
(
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
):
if
self
.
proto
>=
2
:
self
.
write
(
NEWTRUE
if
obj
else
NEWFALSE
)
...
...
Modules/_pickle.c
Dosyayı görüntüle @
c49477b1
...
...
@@ -3171,30 +3171,6 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
return
status
;
}
static
int
save_ellipsis
(
PicklerObject
*
self
,
PyObject
*
obj
)
{
PyObject
*
str
=
PyUnicode_FromString
(
"Ellipsis"
);
int
res
;
if
(
str
==
NULL
)
return
-
1
;
res
=
save_global
(
self
,
Py_Ellipsis
,
str
);
Py_DECREF
(
str
);
return
res
;
}
static
int
save_notimplemented
(
PicklerObject
*
self
,
PyObject
*
obj
)
{
PyObject
*
str
=
PyUnicode_FromString
(
"NotImplemented"
);
int
res
;
if
(
str
==
NULL
)
return
-
1
;
res
=
save_global
(
self
,
Py_NotImplemented
,
str
);
Py_DECREF
(
str
);
return
res
;
}
static
int
save_pers
(
PicklerObject
*
self
,
PyObject
*
obj
,
PyObject
*
func
)
{
...
...
@@ -3552,14 +3528,6 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
status
=
save_none
(
self
,
obj
);
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
)
{
status
=
save_bool
(
self
,
obj
);
goto
done
;
...
...
Objects/object.c
Dosyayı görüntüle @
c49477b1
...
...
@@ -1464,6 +1464,17 @@ NotImplemented_repr(PyObject *op)
return
PyUnicode_FromString
(
"NotImplemented"
);
}
static
PyObject
*
NotImplemented_reduce
(
PyObject
*
op
)
{
return
PyUnicode_FromString
(
"NotImplemented"
);
}
static
PyMethodDef
notimplemented_methods
[]
=
{
{
"__reduce__"
,
(
PyCFunction
)
NotImplemented_reduce
,
METH_NOARGS
,
NULL
},
{
NULL
,
NULL
}
};
static
PyObject
*
notimplemented_new
(
PyTypeObject
*
type
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
...
...
@@ -1511,7 +1522,7 @@ static PyTypeObject PyNotImplemented_Type = {
0
,
/*tp_weaklistoffset */
0
,
/*tp_iter */
0
,
/*tp_iternext */
0
,
/*tp_methods */
notimplemented_methods
,
/*tp_methods */
0
,
/*tp_members */
0
,
/*tp_getset */
0
,
/*tp_base */
...
...
Objects/sliceobject.c
Dosyayı görüntüle @
c49477b1
...
...
@@ -33,6 +33,17 @@ ellipsis_repr(PyObject *op)
return
PyUnicode_FromString
(
"Ellipsis"
);
}
static
PyObject
*
ellipsis_reduce
(
PyObject
*
op
)
{
return
PyUnicode_FromString
(
"Ellipsis"
);
}
static
PyMethodDef
ellipsis_methods
[]
=
{
{
"__reduce__"
,
(
PyCFunction
)
ellipsis_reduce
,
METH_NOARGS
,
NULL
},
{
NULL
,
NULL
}
};
PyTypeObject
PyEllipsis_Type
=
{
PyVarObject_HEAD_INIT
(
&
PyType_Type
,
0
)
"ellipsis"
,
/* tp_name */
...
...
@@ -61,7 +72,7 @@ PyTypeObject PyEllipsis_Type = {
0
,
/* tp_weaklistoffset */
0
,
/* tp_iter */
0
,
/* tp_iternext */
0
,
/* tp_methods */
ellipsis_methods
,
/* tp_methods */
0
,
/* tp_members */
0
,
/* tp_getset */
0
,
/* tp_base */
...
...
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