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
4895af4e
Kaydet (Commit)
4895af4e
authored
Ara 13, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix the ignoring of __cmp__ method on metaclasses #7491
üst
2a08b42e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
test_descr.py
Lib/test/test_descr.py
+9
-0
NEWS
Misc/NEWS
+2
-0
typeobject.c
Objects/typeobject.c
+5
-1
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
4895af4e
...
@@ -1222,6 +1222,15 @@ order (MRO) for bases """
...
@@ -1222,6 +1222,15 @@ order (MRO) for bases """
# This used to crash
# This used to crash
self
.
assertRaises
(
TypeError
,
MyABC
.
a
.
__set__
,
u
,
3
)
self
.
assertRaises
(
TypeError
,
MyABC
.
a
.
__set__
,
u
,
3
)
def
test_metaclass_cmp
(
self
):
# See bug 7491.
class
M
(
type
):
def
__cmp__
(
self
,
other
):
return
-
1
class
X
(
object
):
__metaclass__
=
M
self
.
assertTrue
(
X
<
M
)
def
test_dynamics
(
self
):
def
test_dynamics
(
self
):
# Testing class attribute propagation...
# Testing class attribute propagation...
class
D
(
object
):
class
D
(
object
):
...
...
Misc/NEWS
Dosyayı görüntüle @
4895af4e
...
@@ -12,6 +12,8 @@ What's New in Python 2.7 alpha 2?
...
@@ -12,6 +12,8 @@ What's New in Python 2.7 alpha 2?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #7491: Metaclass's __cmp__ method was ignored.
- Issue #7466: segmentation fault when the garbage collector is called
- Issue #7466: segmentation fault when the garbage collector is called
in the middle of populating a tuple. Patch by Florent Xicluna.
in the middle of populating a tuple. Patch by Florent Xicluna.
...
...
Objects/typeobject.c
Dosyayı görüntüle @
4895af4e
...
@@ -628,7 +628,11 @@ type_richcompare(PyObject *v, PyObject *w, int op)
...
@@ -628,7 +628,11 @@ type_richcompare(PyObject *v, PyObject *w, int op)
int
c
;
int
c
;
/* Make sure both arguments are types. */
/* Make sure both arguments are types. */
if
(
!
PyType_Check
(
v
)
||
!
PyType_Check
(
w
))
{
if
(
!
PyType_Check
(
v
)
||
!
PyType_Check
(
w
)
||
/* If there is a __cmp__ method defined, let it be called instead
of our dumb function designed merely to warn. See bug
#7491. */
Py_TYPE
(
v
)
->
tp_compare
||
Py_TYPE
(
w
)
->
tp_compare
)
{
result
=
Py_NotImplemented
;
result
=
Py_NotImplemented
;
goto
out
;
goto
out
;
}
}
...
...
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