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
6b1e43b7
Kaydet (Commit)
6b1e43b7
authored
May 20, 2009
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5829: complex('1e500') shouldn't raise OverflowError
üst
e2e1561a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
test_complex.py
Lib/test/test_complex.py
+7
-0
NEWS
Misc/NEWS
+4
-0
complexobject.c
Objects/complexobject.c
+2
-2
No files found.
Lib/test/test_complex.py
Dosyayı görüntüle @
6b1e43b7
...
...
@@ -407,6 +407,13 @@ class ComplexTest(unittest.TestCase):
self
.
assertEquals
(
atan2
(
z1
.
imag
,
-
1.
),
atan2
(
0.
,
-
1.
))
self
.
assertEquals
(
atan2
(
z2
.
imag
,
-
1.
),
atan2
(
-
0.
,
-
1.
))
@unittest.skipUnless
(
float
.
__getformat__
(
"double"
)
.
startswith
(
"IEEE"
),
"test requires IEEE 754 doubles"
)
def
test_overflow
(
self
):
self
.
assertEqual
(
complex
(
"1e500"
),
complex
(
INF
,
0.0
))
self
.
assertEqual
(
complex
(
"-1e500j"
),
complex
(
0.0
,
-
INF
))
self
.
assertEqual
(
complex
(
"-1e500+1.8e308j"
),
complex
(
-
INF
,
INF
))
@unittest.skipUnless
(
float
.
__getformat__
(
"double"
)
.
startswith
(
"IEEE"
),
"test requires IEEE 754 doubles"
)
def
test_repr_roundtrip
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
6b1e43b7
...
...
@@ -12,6 +12,10 @@ What's New in Python 3.1 release candidate 1?
Core and Builtins
-----------------
- Issue #5829: complex("1e500") no longer raises OverflowError. This
makes it consistent with float("1e500") and interpretation of real
and imaginary literals.
- Issue #3527: Removed Py_WIN_WIDE_FILENAMES which is not used any more.
- Issue #5994: the marshal module now has docstrings.
...
...
Objects/complexobject.c
Dosyayı görüntüle @
6b1e43b7
...
...
@@ -799,7 +799,7 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
*/
/* first look for forms starting with <float> */
z
=
PyOS_string_to_double
(
s
,
&
end
,
PyExc_OverflowError
);
z
=
PyOS_string_to_double
(
s
,
&
end
,
NULL
);
if
(
z
==
-
1
.
0
&&
PyErr_Occurred
())
{
if
(
PyErr_ExceptionMatches
(
PyExc_ValueError
))
PyErr_Clear
();
...
...
@@ -812,7 +812,7 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
if
(
*
s
==
'+'
||
*
s
==
'-'
)
{
/* <float><signed-float>j | <float><sign>j */
x
=
z
;
y
=
PyOS_string_to_double
(
s
,
&
end
,
PyExc_OverflowError
);
y
=
PyOS_string_to_double
(
s
,
&
end
,
NULL
);
if
(
y
==
-
1
.
0
&&
PyErr_Occurred
())
{
if
(
PyErr_ExceptionMatches
(
PyExc_ValueError
))
PyErr_Clear
();
...
...
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