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
6997946e
Kaydet (Commit)
6997946e
authored
Eyl 24, 2016
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #28203: Merge from 3.5
üst
938da643
613f8e51
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
6 deletions
+29
-6
test_complex.py
Lib/test/test_complex.py
+8
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
complexobject.c
Objects/complexobject.c
+17
-6
No files found.
Lib/test/test_complex.py
Dosyayı görüntüle @
6997946e
...
@@ -328,6 +328,14 @@ class ComplexTest(unittest.TestCase):
...
@@ -328,6 +328,14 @@ class ComplexTest(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
complex
,
"1e1ej"
)
self
.
assertRaises
(
ValueError
,
complex
,
"1e1ej"
)
self
.
assertRaises
(
ValueError
,
complex
,
"1e++1ej"
)
self
.
assertRaises
(
ValueError
,
complex
,
"1e++1ej"
)
self
.
assertRaises
(
ValueError
,
complex
,
")1+2j("
)
self
.
assertRaises
(
ValueError
,
complex
,
")1+2j("
)
self
.
assertRaisesRegex
(
TypeError
,
"first argument must be a string or a number, not 'dict'"
,
complex
,
{
1
:
2
},
1
)
self
.
assertRaisesRegex
(
TypeError
,
"second argument must be a number, not 'dict'"
,
complex
,
1
,
{
1
:
2
})
# the following three are accepted by Python 2.6
# the following three are accepted by Python 2.6
self
.
assertRaises
(
ValueError
,
complex
,
"1..1j"
)
self
.
assertRaises
(
ValueError
,
complex
,
"1..1j"
)
self
.
assertRaises
(
ValueError
,
complex
,
"1.11.1j"
)
self
.
assertRaises
(
ValueError
,
complex
,
"1.11.1j"
)
...
...
Misc/ACKS
Dosyayı görüntüle @
6997946e
...
@@ -1369,6 +1369,7 @@ Daniel Shahaf
...
@@ -1369,6 +1369,7 @@ Daniel Shahaf
Mark Shannon
Mark Shannon
Ha Shao
Ha Shao
Richard Shapiro
Richard Shapiro
Soumya Sharma
Varun Sharma
Varun Sharma
Daniel Shaulov
Daniel Shaulov
Vlad Shcherbina
Vlad Shcherbina
...
...
Misc/NEWS
Dosyayı görüntüle @
6997946e
...
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2
...
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #28203: Fix incorrect type in complex(1.0, {2:3}) error message.
Patch by Soumya Sharma.
- Issue #28086: Single var-positional argument of tuple subtype was passed
- Issue #28086: Single var-positional argument of tuple subtype was passed
unscathed to the C-defined function. Now it is converted to exact tuple.
unscathed to the C-defined function. Now it is converted to exact tuple.
...
...
Objects/complexobject.c
Dosyayı görüntüle @
6997946e
...
@@ -965,18 +965,29 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
...
@@ -965,18 +965,29 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
}
nbr
=
r
->
ob_type
->
tp_as_number
;
nbr
=
r
->
ob_type
->
tp_as_number
;
if
(
i
!=
NULL
)
if
(
nbr
==
NULL
||
nbr
->
nb_float
==
NULL
)
{
nbi
=
i
->
ob_type
->
tp_as_number
;
if
(
nbr
==
NULL
||
nbr
->
nb_float
==
NULL
||
((
i
!=
NULL
)
&&
(
nbi
==
NULL
||
nbi
->
nb_float
==
NULL
)))
{
PyErr_Format
(
PyExc_TypeError
,
PyErr_Format
(
PyExc_TypeError
,
"complex() argument must be a string or a number, not '%.200s'"
,
"complex() first argument must be a string or a number, "
Py_TYPE
(
r
)
->
tp_name
);
"not '%.200s'"
,
Py_TYPE
(
r
)
->
tp_name
);
if
(
own_r
)
{
if
(
own_r
)
{
Py_DECREF
(
r
);
Py_DECREF
(
r
);
}
}
return
NULL
;
return
NULL
;
}
}
if
(
i
!=
NULL
)
{
nbi
=
i
->
ob_type
->
tp_as_number
;
if
(
nbi
==
NULL
||
nbi
->
nb_float
==
NULL
)
{
PyErr_Format
(
PyExc_TypeError
,
"complex() second argument must be a number, "
"not '%.200s'"
,
Py_TYPE
(
i
)
->
tp_name
);
if
(
own_r
)
{
Py_DECREF
(
r
);
}
return
NULL
;
}
}
/* If we get this far, then the "real" and "imag" parts should
/* If we get this far, then the "real" and "imag" parts should
both be treated as numbers, and the constructor should return a
both be treated as numbers, and the constructor should return a
...
...
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