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
a12eec48
Kaydet (Commit)
a12eec48
authored
Agu 19, 2016
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27128: Cleanup slot_nb_bool()
Use an error label to reduce the level of indentation.
üst
5e87749a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
25 deletions
+41
-25
typeobject.c
Objects/typeobject.c
+41
-25
No files found.
Objects/typeobject.c
Dosyayı görüntüle @
a12eec48
...
...
@@ -5946,44 +5946,60 @@ SLOT0(slot_nb_absolute, "__abs__")
static
int
slot_nb_bool
(
PyObject
*
self
)
{
PyObject
*
func
,
*
args
;
int
result
=
-
1
;
PyObject
*
func
,
*
args
,
*
value
;
int
result
;
int
using_len
=
0
;
_Py_IDENTIFIER
(
__bool__
);
func
=
lookup_maybe
(
self
,
&
PyId___bool__
);
if
(
func
==
NULL
)
{
if
(
PyErr_Occurred
())
if
(
PyErr_Occurred
())
{
return
-
1
;
}
func
=
lookup_maybe
(
self
,
&
PyId___len__
);
if
(
func
==
NULL
)
return
PyErr_Occurred
()
?
-
1
:
1
;
if
(
func
==
NULL
)
{
if
(
PyErr_Occurred
())
{
return
-
1
;
}
return
1
;
}
using_len
=
1
;
}
args
=
PyTuple_New
(
0
);
if
(
args
!=
NULL
)
{
PyObject
*
temp
=
PyObject_Call
(
func
,
args
,
NULL
);
Py_DECREF
(
args
);
if
(
temp
!=
NULL
)
{
if
(
using_len
)
{
/* enforced by slot_nb_len */
result
=
PyObject_IsTrue
(
temp
);
}
else
if
(
PyBool_Check
(
temp
))
{
result
=
PyObject_IsTrue
(
temp
);
}
else
{
PyErr_Format
(
PyExc_TypeError
,
"__bool__ should return "
"bool, returned %s"
,
Py_TYPE
(
temp
)
->
tp_name
);
result
=
-
1
;
}
Py_DECREF
(
temp
);
}
if
(
args
==
NULL
)
{
goto
error
;
}
value
=
PyObject_Call
(
func
,
args
,
NULL
);
Py_DECREF
(
args
);
if
(
value
==
NULL
)
{
goto
error
;
}
if
(
using_len
)
{
/* bool type enforced by slot_nb_len */
result
=
PyObject_IsTrue
(
value
);
}
else
if
(
PyBool_Check
(
value
))
{
result
=
PyObject_IsTrue
(
value
);
}
else
{
PyErr_Format
(
PyExc_TypeError
,
"__bool__ should return "
"bool, returned %s"
,
Py_TYPE
(
value
)
->
tp_name
);
result
=
-
1
;
}
Py_DECREF
(
value
);
Py_DECREF
(
func
);
return
result
;
error
:
Py_DECREF
(
func
);
return
-
1
;
}
...
...
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