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
db81e8dd
Kaydet (Commit)
db81e8dd
authored
Mar 23, 2001
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for weak references to the function and method types.
üst
6a1c87dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
classobject.c
Objects/classobject.c
+6
-1
funcobject.c
Objects/funcobject.c
+7
-2
No files found.
Objects/classobject.c
Dosyayı görüntüle @
db81e8dd
...
@@ -1805,6 +1805,7 @@ PyMethod_New(PyObject *func, PyObject *self, PyObject *class)
...
@@ -1805,6 +1805,7 @@ PyMethod_New(PyObject *func, PyObject *self, PyObject *class)
if
(
im
==
NULL
)
if
(
im
==
NULL
)
return
NULL
;
return
NULL
;
}
}
im
->
im_weakreflist
=
NULL
;
Py_INCREF
(
func
);
Py_INCREF
(
func
);
im
->
im_func
=
func
;
im
->
im_func
=
func
;
Py_XINCREF
(
self
);
Py_XINCREF
(
self
);
...
@@ -1902,6 +1903,7 @@ instancemethod_getattro(register PyMethodObject *im, PyObject *name)
...
@@ -1902,6 +1903,7 @@ instancemethod_getattro(register PyMethodObject *im, PyObject *name)
static
void
static
void
instancemethod_dealloc
(
register
PyMethodObject
*
im
)
instancemethod_dealloc
(
register
PyMethodObject
*
im
)
{
{
PyObject_ClearWeakRefs
((
PyObject
*
)
im
);
PyObject_GC_Fini
(
im
);
PyObject_GC_Fini
(
im
);
Py_DECREF
(
im
->
im_func
);
Py_DECREF
(
im
->
im_func
);
Py_XDECREF
(
im
->
im_self
);
Py_XDECREF
(
im
->
im_self
);
...
@@ -2019,9 +2021,12 @@ PyTypeObject PyMethod_Type = {
...
@@ -2019,9 +2021,12 @@ PyTypeObject PyMethod_Type = {
(
getattrofunc
)
instancemethod_getattro
,
/* tp_getattro */
(
getattrofunc
)
instancemethod_getattro
,
/* tp_getattro */
(
setattrofunc
)
instancemethod_setattro
,
/* tp_setattro */
(
setattrofunc
)
instancemethod_setattro
,
/* tp_setattro */
0
,
/* tp_as_buffer */
0
,
/* tp_as_buffer */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_GC
,
/* tp_flags */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_GC
|
Py_TPFLAGS_HAVE_WEAKREFS
,
0
,
/* tp_doc */
0
,
/* tp_doc */
(
traverseproc
)
instancemethod_traverse
,
/* tp_traverse */
(
traverseproc
)
instancemethod_traverse
,
/* tp_traverse */
0
,
/* tp_clear */
0
,
/* tp_richcompare */
offsetof
(
PyMethodObject
,
im_weakreflist
)
/* tp_weaklistoffset */
};
};
/* Clear out the free list */
/* Clear out the free list */
...
...
Objects/funcobject.c
Dosyayı görüntüle @
db81e8dd
...
@@ -13,6 +13,7 @@ PyFunction_New(PyObject *code, PyObject *globals)
...
@@ -13,6 +13,7 @@ PyFunction_New(PyObject *code, PyObject *globals)
if
(
op
!=
NULL
)
{
if
(
op
!=
NULL
)
{
PyObject
*
doc
;
PyObject
*
doc
;
PyObject
*
consts
;
PyObject
*
consts
;
op
->
func_weakreflist
=
NULL
;
Py_INCREF
(
code
);
Py_INCREF
(
code
);
op
->
func_code
=
code
;
op
->
func_code
=
code
;
Py_INCREF
(
globals
);
Py_INCREF
(
globals
);
...
@@ -245,6 +246,7 @@ func_setattro(PyFunctionObject *op, PyObject *name, PyObject *value)
...
@@ -245,6 +246,7 @@ func_setattro(PyFunctionObject *op, PyObject *name, PyObject *value)
static
void
static
void
func_dealloc
(
PyFunctionObject
*
op
)
func_dealloc
(
PyFunctionObject
*
op
)
{
{
PyObject_ClearWeakRefs
((
PyObject
*
)
op
);
PyObject_GC_Fini
(
op
);
PyObject_GC_Fini
(
op
);
Py_DECREF
(
op
->
func_code
);
Py_DECREF
(
op
->
func_code
);
Py_DECREF
(
op
->
func_globals
);
Py_DECREF
(
op
->
func_globals
);
...
@@ -327,13 +329,16 @@ PyTypeObject PyFunction_Type = {
...
@@ -327,13 +329,16 @@ PyTypeObject PyFunction_Type = {
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
0
,
/*tp_as_mapping*/
0
,
/*tp_hash*/
0
,
/*tp_hash*/
0
,
/*tp_call*/
0
,
/*tp_call*/
0
,
/*tp_str*/
0
,
/*tp_str*/
(
getattrofunc
)
func_getattro
,
/*tp_getattro*/
(
getattrofunc
)
func_getattro
,
/*tp_getattro*/
(
setattrofunc
)
func_setattro
,
/*tp_setattro*/
(
setattrofunc
)
func_setattro
,
/*tp_setattro*/
0
,
/* tp_as_buffer */
0
,
/* tp_as_buffer */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_GC
,
/*tp_flags*/
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_GC
|
Py_TPFLAGS_HAVE_WEAKREFS
,
0
,
/* tp_doc */
0
,
/* tp_doc */
(
traverseproc
)
func_traverse
,
/* tp_traverse */
(
traverseproc
)
func_traverse
,
/* tp_traverse */
0
,
/* tp_clear */
0
,
/* tp_richcompare */
offsetof
(
PyFunctionObject
,
func_weakreflist
),
/* tp_weaklistoffset */
};
};
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