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
d614e707
Kaydet (Commit)
d614e707
authored
Mar 21, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
rewrite this function, which was still accounting for classic classes
üst
65e32d1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
24 deletions
+12
-24
abstract.c
Objects/abstract.c
+12
-24
No files found.
Objects/abstract.c
Dosyayı görüntüle @
d614e707
...
...
@@ -1271,34 +1271,22 @@ PyNumber_AsSsize_t(PyObject *item, PyObject *err)
PyObject
*
_PyNumber_ConvertIntegralToInt
(
PyObject
*
integral
,
const
char
*
error_format
)
{
static
PyObject
*
int_name
=
NULL
;
if
(
int_name
==
NULL
)
{
int_name
=
PyUnicode_InternFromString
(
"__int__"
);
if
(
int_name
==
NULL
)
return
NULL
;
}
if
(
integral
&&
!
PyLong_Check
(
integral
))
{
/* Don't go through tp_as_number->nb_int to avoid
hitting the classic class fallback to __trunc__. */
PyObject
*
int_func
=
PyObject_GetAttr
(
integral
,
int_name
);
if
(
int_func
==
NULL
)
{
PyErr_Clear
();
/* Raise a different error. */
goto
non_integral_error
;
}
PyNumberMethods
*
nb
;
if
(
PyLong_Check
(
integral
))
return
integral
;
nb
=
Py_TYPE
(
integral
)
->
tp_as_number
;
if
(
nb
->
nb_int
)
{
PyObject
*
as_int
=
nb
->
nb_int
(
integral
);
Py_DECREF
(
integral
);
i
ntegral
=
PyEval_CallObject
(
int_func
,
NULL
);
Py_DECREF
(
int_func
)
;
if
(
integral
&&
!
PyLong_Check
(
integral
))
{
goto
non_integral_error
;
}
i
f
(
!
as_int
)
return
NULL
;
if
(
PyLong_Check
(
as_int
))
return
as_int
;
Py_DECREF
(
as_int
);
}
return
integral
;
non_integral_error
:
PyErr_Format
(
PyExc_TypeError
,
error_format
,
Py_TYPE
(
integral
)
->
tp_name
);
Py_DECREF
(
integral
);
return
NULL
;
return
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