Author: Brian Kearns <[email protected]>
Branch:
Changeset: r71423:2b4f2f6ed112
Date: 2014-05-08 17:43 -0400
http://bitbucket.org/pypy/pypy/changeset/2b4f2f6ed112/
Log: reject whitespace here too
diff --git a/pypy/objspace/std/complextype.py b/pypy/objspace/std/complextype.py
--- a/pypy/objspace/std/complextype.py
+++ b/pypy/objspace/std/complextype.py
@@ -77,9 +77,6 @@
raise ValueError
i += 1
- # whitespace
- while i < slen and s[i] == ' ':
- i += 1
if i >= slen:
raise ValueError
diff --git a/pypy/objspace/std/test/test_complexobject.py
b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -38,7 +38,6 @@
test_cparse('(1+2j)', '1', '2')
test_cparse('(1-6j)', '1', '-6')
test_cparse(' ( +3.14-6J )', '+3.14', '-6')
- test_cparse(' ( +3.14- 6J ) ', '+3.14', '-6')
test_cparse(' +J', '0.0', '1.0')
test_cparse(' -J', '0.0', '-1.0')
@@ -307,6 +306,8 @@
assert self.almost_equal(complex("-1"), -1)
assert self.almost_equal(complex("+1"), +1)
assert self.almost_equal(complex(" ( +3.14-6J ) "), 3.14-6j)
+ exc = raises(ValueError, complex, " ( +3.14- 6J ) ")
+ assert str(exc.value) == "complex() arg is a malformed string"
class complex2(complex):
pass
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit