Issue1779428

classification
Title: patch for : [ 1758284 ] Complex parses complex('1' * 500) as
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pjenvey, ukeshav
Priority: normal Keywords: patch

Created on 2007-08-22.13:45:30 by ukeshav, last changed 2008-04-07.03:58:53 by pjenvey.

Files
File name Uploaded Description Edit Remove
bug_1758284.diff ukeshav, 2007-08-22.13:45:30 patch file
bug_complex_range.diff ukeshav, 2007-09-26.07:19:31 patch file
Messages
msg2815 (view) Author: keshav upadhyaya (ukeshav) Date: 2007-08-22.13:45:30
hi i have added one check  for infinite and resolve the issue now test_complex is running fine
msg2816 (view) Author: Philip Jenvey (pjenvey) Date: 2007-09-22.01:50:43
Is the comparison of x to Double.NEGATIVE_INFINITY a typo? Shouldn't that be compared against z?:

                 z = Double.valueOf(string.substring(s, end)).doubleValue();
-                if (z == Double.POSITIVE_INFINITY || x == Double.NEGATIVE_INFINITY) {
-                       throw Py.ValueError("double() out of range:" + string);
+                if (z == Double.NEGATIVE_INFINITY || z == Double.POSITIVE_INFINITY) {
+                       throw Py.ValueError("float() out of range: " + string);
                 }
msg2817 (view) Author: Philip Jenvey (pjenvey) Date: 2007-09-22.01:54:37
sourceforge kind of munged the diff I was trying to present to you, maybe this one will be easier to read:

 z = Double.valueOf(string.substring(s, end)).doubleValue();
-if (z == Double.POSITIVE_INFINITY || x == Double.NEGATIVE_INFINITY) {
-    throw Py.ValueError("double() out of range:" + string);
+if (z == Double.NEGATIVE_INFINITY || z == Double.POSITIVE_INFINITY) {
+    throw Py.ValueError("float() out of range: " + string);
 }
 
Also this patch contains a tab character. Could you please disable tabs in your editor for all future patches? The codebase prefers spaces, thanks!
msg2818 (view) Author: Philip Jenvey (pjenvey) Date: 2007-09-22.02:05:38
actually, is the NEGATIVE_INFINITY check needed at all? seems like the way complex parses numbers, they might only be positive in this case, but I'm not totally sure about that
msg2819 (view) Author: keshav upadhyaya (ukeshav) Date: 2007-09-26.07:19:31
pjenvey :-

if we are checking with varible Z we need not to check with NEGATIVE_INFINITY 
it is needed only when we are checking with variable x 

i am attaching patch plz have a look on it..

File Added: bug_complex_range.diff
msg3120 (view) Author: Philip Jenvey (pjenvey) Date: 2008-04-07.03:58:28
applied in r4312, thanks ukeshav!
History
Date User Action Args
2008-04-07 03:58:53pjenveysetcomponents: + Core, - None
2008-04-07 03:58:29pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg3120
2007-08-22 13:45:30ukeshavcreate