Hi, while fixing pypy to pass CPython 3.2 tests, I found what I think it's a inconsistency in how CPython (both 2.7 and 3.2) handles __complex__:
>>> class Obj: ... def __complex__(self): ... return 2.0 ... >>> obj = Obj() >>> complex(obj) (2+0j) >>> >>> import cmath >>> cmath.acos(obj) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __complex__ should return a complex object i.e., the complex constructor does not check that __complex__ returns an actual complex, while the cmath functions do. To me it looks like a bug in complex_new which should do the check as well; however, there is a test in test_complex.test_constructor which checks that returning a float actually works. Is that the real intended behavior? ciao, Anto _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com