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
4cf6319c
Kaydet (Commit)
4cf6319c
authored
Nis 09, 2003
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make Picklers collectable.
Bug fix candidate.
üst
d06483c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
5 deletions
+45
-5
cPickle.c
Modules/cPickle.c
+45
-5
No files found.
Modules/cPickle.c
Dosyayı görüntüle @
4cf6319c
...
...
@@ -2724,7 +2724,7 @@ newPicklerobject(PyObject *file, int proto)
return NULL;
}
self
=
PyObject_New
(
Picklerobject
,
&
Picklertype
);
self = PyObject_
GC_
New(Picklerobject, &Picklertype);
if (self == NULL)
return NULL;
self->proto = proto;
...
...
@@ -2807,6 +2807,7 @@ newPicklerobject(PyObject *file, int proto)
self->dispatch_table = dispatch_table;
Py_INCREF(dispatch_table);
}
PyObject_GC_Track(self);
return self;
...
...
@@ -2842,6 +2843,7 @@ get_Pickler(PyObject *self, PyObject *args)
static void
Pickler_dealloc(Picklerobject *self)
{
PyObject_GC_UnTrack(self);
Py_XDECREF(self->write);
Py_XDECREF(self->memo);
Py_XDECREF(self->fast_memo);
...
...
@@ -2851,7 +2853,45 @@ Pickler_dealloc(Picklerobject *self)
Py_XDECREF(self->inst_pers_func);
Py_XDECREF(self->dispatch_table);
PyMem_Free(self->write_buf);
PyObject_Del
(
self
);
PyObject_GC_Del(self);
}
static int
Pickler_traverse(Picklerobject *self, visitproc visit, void *arg)
{
int err;
#define VISIT(SLOT) \
if (SLOT) { \
err = visit((PyObject *)(SLOT), arg); \
if (err) \
return err; \
}
VISIT(self->write);
VISIT(self->memo);
VISIT(self->fast_memo);
VISIT(self->arg);
VISIT(self->file);
VISIT(self->pers_func);
VISIT(self->inst_pers_func);
VISIT(self->dispatch_table);
#undef VISIT
return 0;
}
static int
Pickler_clear(Picklerobject *self)
{
#define CLEAR(SLOT) Py_XDECREF(SLOT); SLOT = NULL;
CLEAR(self->write);
CLEAR(self->memo);
CLEAR(self->fast_memo);
CLEAR(self->arg);
CLEAR(self->file);
CLEAR(self->pers_func);
CLEAR(self->inst_pers_func);
CLEAR(self->dispatch_table);
#undef CLEAR
return 0;
}
static PyObject *
...
...
@@ -2967,10 +3007,10 @@ static PyTypeObject Picklertype = {
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_BASETYPE
,
/* tp_flags */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
| Py_TPFLAGS_HAVE_GC,
Picklertype__doc__, /* tp_doc */
0
,
/* tp_traverse */
0
,
/* tp_clear */
(traverseproc)Pickler_traverse,
/* tp_traverse */
(inquiry)Pickler_clear,
/* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
...
...
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