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
6e467049
Kaydet (Commit)
6e467049
authored
Kas 10, 2012
tarafından
Stefan Krah
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Accept Unicode legacy strings in the Decimal constructor.
üst
6b0bdab4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
test_decimal.py
Lib/test/test_decimal.py
+10
-1
_decimal.c
Modules/_decimal/_decimal.c
+3
-1
No files found.
Lib/test/test_decimal.py
Dosyayı görüntüle @
6e467049
...
...
@@ -35,7 +35,7 @@ import locale
from
test.support
import
(
run_unittest
,
run_doctest
,
is_resource_enabled
,
requires_IEEE_754
)
from
test.support
import
(
check_warnings
,
import_fresh_module
,
TestFailed
,
run_with_locale
)
run_with_locale
,
cpython_only
)
import
random
import
time
import
warnings
...
...
@@ -574,6 +574,15 @@ class ExplicitConstructionTest(unittest.TestCase):
# embedded NUL
self
.
assertRaises
(
InvalidOperation
,
Decimal
,
"12
\u0000
3"
)
@cpython_only
def
test_from_legacy_strings
(
self
):
import
_testcapi
Decimal
=
self
.
decimal
.
Decimal
context
=
self
.
decimal
.
Context
()
s
=
_testcapi
.
unicode_legacy_string
(
'9.999999'
)
self
.
assertEqual
(
str
(
Decimal
(
s
)),
'9.999999'
)
self
.
assertEqual
(
str
(
context
.
create_decimal
(
s
)),
'9.999999'
)
def
test_explicit_from_tuples
(
self
):
Decimal
=
self
.
decimal
.
Decimal
...
...
Modules/_decimal/_decimal.c
Dosyayı görüntüle @
6e467049
...
...
@@ -1892,7 +1892,9 @@ numeric_as_ascii(const PyObject *u, int strip_ws)
Py_ssize_t
j
,
len
;
int
d
;
assert
(
PyUnicode_IS_READY
(
u
));
if
(
PyUnicode_READY
(
u
)
==
-
1
)
{
return
NULL
;
}
kind
=
PyUnicode_KIND
(
u
);
data
=
PyUnicode_DATA
(
u
);
...
...
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