[pypy-svn] pypy fast-forward: Let cmath functions fail with a TypeError for invalid types
amauryfa
commits-noreply at bitbucket.org
Thu Jan 6 18:40:51 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40419:da916178b2a4
Date: 2011-01-04 19:41 +0100
http://bitbucket.org/pypy/pypy/changeset/da916178b2a4/
Log: Let cmath functions fail with a TypeError for invalid types
diff --git a/lib_pypy/cmath.py b/lib_pypy/cmath.py
--- a/lib_pypy/cmath.py
+++ b/lib_pypy/cmath.py
@@ -25,7 +25,7 @@
if isinstance(x, complex):
return x
if isinstance(x, (str, unicode)):
- return x # and let it fail later
+ raise TypeError('float or complex required')
return complex(x)
def _prodi(x):
More information about the Pypy-commit
mailing list