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
74a1deaa
Kaydet (Commit)
74a1deaa
authored
May 28, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#2989: add PyType_Modified().
üst
88eeef35
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
12 deletions
+23
-12
type.rst
Doc/c-api/type.rst
+10
-1
object.h
Include/object.h
+1
-0
NEWS
Misc/NEWS
+3
-1
typeobject.c
Objects/typeobject.c
+9
-10
No files found.
Doc/c-api/type.rst
Dosyayı görüntüle @
74a1deaa
...
...
@@ -37,7 +37,16 @@ Type Objects
.. cfunction:: unsigned int PyType_ClearCache(void)
Clears the internal lookup cache. Return the current version tag.
Clear the internal lookup cache. Return the current version tag.
.. versionadded:: 2.6
.. cfunction:: void PyType_Modified(PyTypeObject *type)
Invalidate the internal lookup cache for the type and all of its
subtypes. This function must be called after any manual
modification of the attributes or base classes of the type.
.. versionadded:: 2.6
...
...
Include/object.h
Dosyayı görüntüle @
74a1deaa
...
...
@@ -460,6 +460,7 @@ PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
PyObject
*
,
PyObject
*
);
PyAPI_FUNC
(
PyObject
*
)
_PyType_Lookup
(
PyTypeObject
*
,
PyObject
*
);
PyAPI_FUNC
(
unsigned
int
)
PyType_ClearCache
(
void
);
PyAPI_FUNC
(
void
)
PyType_Modified
(
PyTypeObject
*
);
/* Generic operations on objects */
PyAPI_FUNC
(
int
)
PyObject_Print
(
PyObject
*
,
FILE
*
,
int
);
...
...
Misc/NEWS
Dosyayı görüntüle @
74a1deaa
...
...
@@ -239,7 +239,9 @@ Build
C API
-----
- The PyBytes functions have been renamed to PyByteArray
- Add ``PyType_Modified()`` as a public API to clear the type cache.
- The PyBytes functions have been renamed to PyByteArray.
- The PyString functions have been renamed to PyBytes. A batch of
defines were added so that the linker still sees the original
...
...
Objects/typeobject.c
Dosyayı görüntüle @
74a1deaa
...
...
@@ -32,7 +32,6 @@ struct method_cache_entry {
static
struct
method_cache_entry
method_cache
[
1
<<
MCACHE_SIZE_EXP
];
static
unsigned
int
next_version_tag
=
0
;
static
void
type_modified
(
PyTypeObject
*
);
unsigned
int
PyType_ClearCache
(
void
)
...
...
@@ -47,12 +46,12 @@ PyType_ClearCache(void)
}
next_version_tag
=
0
;
/* mark all version tags as invalid */
type_m
odified
(
&
PyBaseObject_Type
);
PyType_M
odified
(
&
PyBaseObject_Type
);
return
cur_version_tag
;
}
static
void
type_m
odified
(
PyTypeObject
*
type
)
void
PyType_M
odified
(
PyTypeObject
*
type
)
{
/* Invalidate any cached data for the specified type and all
subclasses. This function is called after the base
...
...
@@ -86,7 +85,7 @@ type_modified(PyTypeObject *type)
ref
=
PyList_GET_ITEM
(
raw
,
i
);
ref
=
PyWeakref_GET_OBJECT
(
ref
);
if
(
ref
!=
Py_None
)
{
type_m
odified
((
PyTypeObject
*
)
ref
);
PyType_M
odified
((
PyTypeObject
*
)
ref
);
}
}
}
...
...
@@ -172,7 +171,7 @@ assign_version_tag(PyTypeObject *type)
Py_INCREF
(
Py_None
);
}
/* mark all version tags as invalid */
type_m
odified
(
&
PyBaseObject_Type
);
PyType_M
odified
(
&
PyBaseObject_Type
);
return
1
;
}
bases
=
type
->
tp_bases
;
...
...
@@ -300,7 +299,7 @@ type_set_module(PyTypeObject *type, PyObject *value, void *context)
return
-
1
;
}
type_m
odified
(
type
);
PyType_M
odified
(
type
);
return
PyDict_SetItemString
(
type
->
tp_dict
,
"__module__"
,
value
);
}
...
...
@@ -328,7 +327,7 @@ type_set_abstractmethods(PyTypeObject *type, PyObject *value, void *context)
int
res
=
PyDict_SetItemString
(
type
->
tp_dict
,
"__abstractmethods__"
,
value
);
if
(
res
==
0
)
{
type_m
odified
(
type
);
PyType_M
odified
(
type
);
if
(
value
&&
PyObject_IsTrue
(
value
))
{
type
->
tp_flags
|=
Py_TPFLAGS_IS_ABSTRACT
;
}
...
...
@@ -1621,7 +1620,7 @@ mro_internal(PyTypeObject *type)
from the custom MRO */
type_mro_modified
(
type
,
type
->
tp_bases
);
type_m
odified
(
type
);
PyType_M
odified
(
type
);
return
0
;
}
...
...
@@ -6092,7 +6091,7 @@ update_slot(PyTypeObject *type, PyObject *name)
update_subclasses() recursion below, but carefully:
they each have their own conditions on which to stop
recursing into subclasses. */
type_m
odified
(
type
);
PyType_M
odified
(
type
);
init_slotdefs
();
pp
=
ptrs
;
...
...
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