[pypy-dev] pow and complex object

Ben Young ben at transversal.com
Mon Jul 5 09:54:49 CEST 2004

On Friday 02 July 2004 19:41, holger krekel wrote:
> Hi Ben,
> [Ben Young Fri, Jul 02, 2004 at 04:44:07PM +0100]
> > I found a few weirdities in pos and complex. I tries to fix them by
> > putting debugging print statements in complexobject.py in appspace but
> > these did not seem to be picked up. Is this the right place to do this or
> > does complex exist somewhere else? (All this is in std object space)
> the class complex now lives in module/__builtin__module.py and i just
> killed the leftover appspace one.  We moved it during the last sprint.
> Note, that module/__builtin__module.py contains regular python code
> while module/__builtin__interp.py contains the part that has to be
> implemented at interpreter-level, e.g. locals().
> > pow(2j, 2) => (1+3.4247374308419473e-311j) should be (-4 + 0j)
> > pow(2j, "fde") => 0j should be type error
> you might fix that now (maybe by writing some tests first and putting
> them into e.g. module/test/test_builtin.py).

Ah, I think I have found the problem! pow(complex(0, 2), 2) does return the 
correct result, however stdobjspace.wrap(2j) does not return a complex 
object, it returns a cpython object. Is there a way to plug factory functions 
into the object space from the module directory or should the complex object 
be lifted to the level of int and long, and be put in the object space?

There also appears to be a problem with pow in general, but I will look at 
this separately.



More information about the Pypy-dev mailing list