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
f9bd6b09
Kaydet (Commit)
f9bd6b09
authored
Şub 18, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Allow __doc__ to be of arbitrary type. Patch by James Henstridge,
fixes #504343. 2.2.1 candidate.
üst
82c6682b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
typeobject.c
Objects/typeobject.c
+16
-4
No files found.
Objects/typeobject.c
Dosyayı görüntüle @
f9bd6b09
...
...
@@ -8,7 +8,6 @@ static PyMemberDef type_members[] = {
{
"__basicsize__"
,
T_INT
,
offsetof
(
PyTypeObject
,
tp_basicsize
),
READONLY
},
{
"__itemsize__"
,
T_INT
,
offsetof
(
PyTypeObject
,
tp_itemsize
),
READONLY
},
{
"__flags__"
,
T_LONG
,
offsetof
(
PyTypeObject
,
tp_flags
),
READONLY
},
{
"__doc__"
,
T_STRING
,
offsetof
(
PyTypeObject
,
tp_doc
),
READONLY
},
{
"__weakrefoffset__"
,
T_LONG
,
offsetof
(
PyTypeObject
,
tp_weaklistoffset
),
READONLY
},
{
"__base__"
,
T_OBJECT
,
offsetof
(
PyTypeObject
,
tp_base
),
READONLY
},
...
...
@@ -1044,9 +1043,9 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
}
/* Set tp_doc to a copy of dict['__doc__'], if the latter is there
and is a string
(tp_doc is a char* -- can't copy a general object
into it).
XXX What if it's a Unicode string? Don't know -- this ignores it
.
and is a string
. Note that the tp_doc slot will only be used
by C code -- python code will use the version in tp_dict, so
it isn't that important that non string __doc__'s are ignored
.
*/
{
PyObject
*
doc
=
PyDict_GetItemString
(
dict
,
"__doc__"
);
...
...
@@ -2024,6 +2023,19 @@ PyType_Ready(PyTypeObject *type)
inherit_slots
(
type
,
(
PyTypeObject
*
)
b
);
}
/* if the type dictionary doesn't contain a __doc__, set it from
the tp_doc slot.
*/
if
(
PyDict_GetItemString
(
type
->
tp_dict
,
"__doc__"
)
==
NULL
)
{
if
(
type
->
tp_doc
!=
NULL
)
{
PyObject
*
doc
=
PyString_FromString
(
type
->
tp_doc
);
PyDict_SetItemString
(
type
->
tp_dict
,
"__doc__"
,
doc
);
Py_DECREF
(
doc
);
}
else
{
PyDict_SetItemString
(
type
->
tp_dict
,
"__doc__"
,
Py_None
);
}
}
/* Some more special stuff */
base
=
type
->
tp_base
;
if
(
base
!=
NULL
)
{
...
...
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