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
e9462c72
Kaydet (Commit)
e9462c72
authored
Agu 04, 2006
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Change fix for segfaulting property(), add a NEWS entry and a test.
üst
06ded09d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
10 deletions
+33
-10
test_descr.py
Lib/test/test_descr.py
+10
-0
NEWS
Misc/NEWS
+2
-0
_testcapimodule.c
Modules/_testcapimodule.c
+9
-0
descrobject.c
Objects/descrobject.c
+12
-10
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
e9462c72
...
...
@@ -2024,6 +2024,16 @@ def properties():
prop2
=
property
(
fset
=
setter
)
vereq
(
prop2
.
__doc__
,
None
)
# this segfaulted in 2.5b2
try
:
import
_testcapi
except
ImportError
:
pass
else
:
class
X
(
object
):
p
=
property
(
_testcapi
.
test_with_docstring
)
def
supers
():
if
verbose
:
print
"Testing super..."
...
...
Misc/NEWS
Dosyayı görüntüle @
e9462c72
...
...
@@ -21,6 +21,8 @@ Core and builtins
in the byte code and co_consts even if they were not used, ie
immediately popped off the stack.
- Fixed a reference-counting problem in property().
Library
-------
...
...
Modules/_testcapimodule.c
Dosyayı görüntüle @
e9462c72
...
...
@@ -706,6 +706,13 @@ test_string_from_format(PyObject *self, PyObject *args)
#undef CHECK_1_FORMAT
}
/* This is here to provide a docstring for test_descr. */
static
PyObject
*
test_with_docstring
(
PyObject
*
self
)
{
Py_RETURN_NONE
;
}
static
PyMethodDef
TestMethods
[]
=
{
{
"raise_exception"
,
raise_exception
,
METH_VARARGS
},
{
"test_config"
,
(
PyCFunction
)
test_config
,
METH_NOARGS
},
...
...
@@ -716,6 +723,8 @@ static PyMethodDef TestMethods[] = {
{
"test_k_code"
,
(
PyCFunction
)
test_k_code
,
METH_NOARGS
},
{
"test_null_strings"
,
(
PyCFunction
)
test_null_strings
,
METH_NOARGS
},
{
"test_string_from_format"
,
(
PyCFunction
)
test_string_from_format
,
METH_NOARGS
},
{
"test_with_docstring"
,
(
PyCFunction
)
test_with_docstring
,
METH_NOARGS
,
PyDoc_STR
(
"This is a pretty normal docstring."
)},
{
"getargs_tuple"
,
getargs_tuple
,
METH_VARARGS
},
{
"getargs_b"
,
getargs_b
,
METH_VARARGS
},
...
...
Objects/descrobject.c
Dosyayı görüntüle @
e9462c72
...
...
@@ -1190,19 +1190,21 @@ property_init(PyObject *self, PyObject *args, PyObject *kwds)
if
(
del
==
Py_None
)
del
=
NULL
;
/* if no docstring given and the getter has one, use that one */
if
((
doc
==
NULL
||
doc
==
Py_None
)
&&
get
!=
NULL
&&
PyObject_HasAttrString
(
get
,
"__doc__"
))
{
doc
=
PyObject_GetAttrString
(
get
,
"__doc__"
);
if
(
doc
==
NULL
)
return
-
1
;
}
else
{
Py_XINCREF
(
doc
);
}
Py_XINCREF
(
get
);
Py_XINCREF
(
set
);
Py_XINCREF
(
del
);
Py_XINCREF
(
doc
);
/* if no docstring given and the getter has one, use that one */
if
((
doc
==
NULL
||
doc
==
Py_None
)
&&
get
!=
NULL
)
{
PyObject
*
get_doc
=
PyObject_GetAttrString
(
get
,
"__doc__"
);
if
(
get_doc
!=
NULL
)
{
Py_XDECREF
(
doc
);
doc
=
get_doc
;
/* get_doc already INCREF'd by GetAttr */
}
else
{
PyErr_Clear
();
}
}
gs
->
prop_get
=
get
;
gs
->
prop_set
=
set
;
...
...
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