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
8113f490
Kaydet (Commit)
8113f490
authored
Haz 20, 2016
tarafından
Stefan Krah
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5.
üst
df1d31c2
6817c59c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
test_decimal.py
Lib/test/test_decimal.py
+4
-1
_decimal.c
Modules/_decimal/_decimal.c
+8
-2
No files found.
Lib/test/test_decimal.py
Dosyayı görüntüle @
8113f490
...
@@ -2524,7 +2524,8 @@ class PythonAPItests(unittest.TestCase):
...
@@ -2524,7 +2524,8 @@ class PythonAPItests(unittest.TestCase):
Decimal
=
self
.
decimal
.
Decimal
Decimal
=
self
.
decimal
.
Decimal
class
MyDecimal
(
Decimal
):
class
MyDecimal
(
Decimal
):
pass
def
__init__
(
self
,
_
):
self
.
x
=
'y'
self
.
assertTrue
(
issubclass
(
MyDecimal
,
Decimal
))
self
.
assertTrue
(
issubclass
(
MyDecimal
,
Decimal
))
...
@@ -2532,6 +2533,8 @@ class PythonAPItests(unittest.TestCase):
...
@@ -2532,6 +2533,8 @@ class PythonAPItests(unittest.TestCase):
self
.
assertEqual
(
type
(
r
),
MyDecimal
)
self
.
assertEqual
(
type
(
r
),
MyDecimal
)
self
.
assertEqual
(
str
(
r
),
self
.
assertEqual
(
str
(
r
),
'0.1000000000000000055511151231257827021181583404541015625'
)
'0.1000000000000000055511151231257827021181583404541015625'
)
self
.
assertEqual
(
r
.
x
,
'y'
)
bigint
=
12345678901234567890123456789
bigint
=
12345678901234567890123456789
self
.
assertEqual
(
MyDecimal
.
from_float
(
bigint
),
MyDecimal
(
bigint
))
self
.
assertEqual
(
MyDecimal
.
from_float
(
bigint
),
MyDecimal
(
bigint
))
self
.
assertTrue
(
MyDecimal
.
from_float
(
float
(
'nan'
))
.
is_qnan
())
self
.
assertTrue
(
MyDecimal
.
from_float
(
float
(
'nan'
))
.
is_qnan
())
...
...
Modules/_decimal/_decimal.c
Dosyayı görüntüle @
8113f490
...
@@ -2629,12 +2629,18 @@ PyDecType_FromSequenceExact(PyTypeObject *type, PyObject *v,
...
@@ -2629,12 +2629,18 @@ PyDecType_FromSequenceExact(PyTypeObject *type, PyObject *v,
/* class method */
/* class method */
static
PyObject
*
static
PyObject
*
dec_from_float
(
PyObject
*
dec
,
PyObject
*
pyfloat
)
dec_from_float
(
PyObject
*
type
,
PyObject
*
pyfloat
)
{
{
PyObject
*
context
;
PyObject
*
context
;
PyObject
*
result
;
CURRENT_CONTEXT
(
context
);
CURRENT_CONTEXT
(
context
);
return
PyDecType_FromFloatExact
((
PyTypeObject
*
)
dec
,
pyfloat
,
context
);
result
=
PyDecType_FromFloatExact
(
&
PyDec_Type
,
pyfloat
,
context
);
if
(
!
PyDec_CheckExact
(
type
)
&&
result
!=
NULL
)
{
Py_SETREF
(
result
,
PyObject_CallFunctionObjArgs
(
type
,
result
,
NULL
));
}
return
result
;
}
}
/* create_decimal_from_float */
/* create_decimal_from_float */
...
...
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