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
1b1a8e7c
Kaydet (Commit)
1b1a8e7c
authored
Mar 21, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
correctly lookup __trunc__ in int() constructor
üst
9fc9bf46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
test_descr.py
Lib/test/test_descr.py
+1
-0
abstract.c
Objects/abstract.c
+3
-2
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
1b1a8e7c
...
...
@@ -1770,6 +1770,7 @@ order (MRO) for bases """
(
"__format__"
,
format
,
format_impl
,
set
(),
{}),
(
"__floor__"
,
math
.
floor
,
zero
,
set
(),
{}),
(
"__trunc__"
,
math
.
trunc
,
zero
,
set
(),
{}),
(
"__trunc__"
,
int
,
zero
,
set
(),
{}),
(
"__ceil__"
,
math
.
ceil
,
zero
,
set
(),
{}),
(
"__dir__"
,
dir
,
empty_seq
,
set
(),
{}),
]
...
...
Objects/abstract.c
Dosyayı görüntüle @
1b1a8e7c
...
...
@@ -1350,7 +1350,7 @@ PyNumber_Long(PyObject *o)
}
if
(
PyLong_Check
(
o
))
/* An int subclass without nb_int */
return
_PyLong_Copy
((
PyLongObject
*
)
o
);
trunc_func
=
_PyObject_
GetAttrId
(
o
,
&
PyId___trunc__
);
trunc_func
=
_PyObject_
LookupSpecial
(
o
,
&
PyId___trunc__
);
if
(
trunc_func
)
{
PyObject
*
truncated
=
PyEval_CallObject
(
trunc_func
,
NULL
);
PyObject
*
int_instance
;
...
...
@@ -1362,7 +1362,8 @@ PyNumber_Long(PyObject *o)
"__trunc__ returned non-Integral (type %.200s)"
);
return
int_instance
;
}
PyErr_Clear
();
/* It's not an error if o.__trunc__ doesn't exist. */
if
(
PyErr_Occurred
())
return
NULL
;
if
(
PyBytes_Check
(
o
))
/* need to do extra error checking that PyLong_FromString()
...
...
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