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
8fbd2954
Kaydet (Commit)
8fbd2954
authored
May 01, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.2 (#14699)
üst
49a69e4d
7295c6a8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
3 deletions
+59
-3
test_descr.py
Lib/test/test_descr.py
+16
-0
NEWS
Misc/NEWS
+2
-0
descrobject.c
Objects/descrobject.c
+41
-3
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
8fbd2954
...
...
@@ -1466,6 +1466,22 @@ order (MRO) for bases """
self
.
assertEqual
(
x
,
spam
.
spamlist
)
self
.
assertEqual
(
a
,
a1
)
self
.
assertEqual
(
d
,
d1
)
spam_cm
=
spam
.
spamlist
.
__dict__
[
'classmeth'
]
x2
,
a2
,
d2
=
spam_cm
(
spam
.
spamlist
,
*
a
,
**
d
)
self
.
assertEqual
(
x2
,
spam
.
spamlist
)
self
.
assertEqual
(
a2
,
a1
)
self
.
assertEqual
(
d2
,
d1
)
class
SubSpam
(
spam
.
spamlist
):
pass
x2
,
a2
,
d2
=
spam_cm
(
SubSpam
,
*
a
,
**
d
)
self
.
assertEqual
(
x2
,
SubSpam
)
self
.
assertEqual
(
a2
,
a1
)
self
.
assertEqual
(
d2
,
d1
)
with
self
.
assertRaises
(
TypeError
):
spam_cm
()
with
self
.
assertRaises
(
TypeError
):
spam_cm
(
spam
.
spamlist
())
with
self
.
assertRaises
(
TypeError
):
spam_cm
(
list
)
def
test_staticmethods
(
self
):
# Testing static methods...
...
...
Misc/NEWS
Dosyayı görüntüle @
8fbd2954
...
...
@@ -10,6 +10,8 @@ What's New in Python 3.3.0 Alpha 3?
Core and Builtins
-----------------
- Issue #14699: Fix calling the classmethod descriptor directly.
- Issue #14433: Prevent msvcrt crash in interactive prompt when stdin
is closed.
...
...
Objects/descrobject.c
Dosyayı görüntüle @
8fbd2954
...
...
@@ -257,14 +257,52 @@ static PyObject *
classmethoddescr_call
(
PyMethodDescrObject
*
descr
,
PyObject
*
args
,
PyObject
*
kwds
)
{
PyObject
*
func
,
*
result
;
Py_ssize_t
argc
;
PyObject
*
self
,
*
func
,
*
result
;
func
=
PyCFunction_New
(
descr
->
d_method
,
(
PyObject
*
)
PyDescr_TYPE
(
descr
));
if
(
func
==
NULL
)
/* Make sure that the first argument is acceptable as 'self' */
assert
(
PyTuple_Check
(
args
));
argc
=
PyTuple_GET_SIZE
(
args
);
if
(
argc
<
1
)
{
PyErr_Format
(
PyExc_TypeError
,
"descriptor '%V' of '%.100s' "
"object needs an argument"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
PyDescr_TYPE
(
descr
)
->
tp_name
);
return
NULL
;
}
self
=
PyTuple_GET_ITEM
(
args
,
0
);
if
(
!
PyType_Check
(
self
))
{
PyErr_Format
(
PyExc_TypeError
,
"descriptor '%V' requires a type "
"but received a '%.100s'"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
PyDescr_TYPE
(
descr
)
->
tp_name
,
self
->
ob_type
->
tp_name
);
return
NULL
;
}
if
(
!
PyType_IsSubtype
((
PyTypeObject
*
)
self
,
PyDescr_TYPE
(
descr
)))
{
PyErr_Format
(
PyExc_TypeError
,
"descriptor '%V' "
"requires a subtype of '%.100s' "
"but received '%.100s"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
PyDescr_TYPE
(
descr
)
->
tp_name
,
self
->
ob_type
->
tp_name
);
return
NULL
;
}
func
=
PyCFunction_New
(
descr
->
d_method
,
self
);
if
(
func
==
NULL
)
return
NULL
;
args
=
PyTuple_GetSlice
(
args
,
1
,
argc
);
if
(
args
==
NULL
)
{
Py_DECREF
(
func
);
return
NULL
;
}
result
=
PyEval_CallObjectWithKeywords
(
func
,
args
,
kwds
);
Py_DECREF
(
func
);
Py_DECREF
(
args
);
return
result
;
}
...
...
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