Index: src/org/python/core/PyString.java =================================================================== --- src/org/python/core/PyString.java (revision 3444) +++ src/org/python/core/PyString.java (working copy) @@ -2330,7 +2330,12 @@ break; } int end = endDouble(string, s); + 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); + } + s=end; if (s < n) { c = string.charAt(s); Index: Lib/test/test_complex.py =================================================================== --- Lib/test/test_complex.py (revision 3416) +++ Lib/test/test_complex.py (working copy) @@ -306,10 +306,7 @@ pass def test_main(): -# Jython transition 2.3 -# complex parses complex('1' * 500) as (Infinity+0j) -# http://jython.org/bugs/1758284 - del ComplexTest.test_constructor + ComplexTest.test_constructor # complex is missing __coerce__ # http://jython.org/bugs/1758282 del ComplexTest.test_coerce