[pypy-dev] pow and complex object

holger krekel hpk at trillke.net
Mon Jul 5 11:33:16 CEST 2004


[Ben Young Mon, Jul 05, 2004 at 09:29:44AM +0100]
> On Monday 05 July 2004 09:16, holger krekel wrote:
> > [Ben Young Mon, Jul 05, 2004 at 08:54:49AM +0100]
> > I think it's ok to add yet another special case to stdobjspace.wrap()
> > to create a proper complex object for compiled literals. The other
> > solution of having a proper complex object in co_consts from the start
> > is problematic because code objects in PyPy are considered an
> > objectspace-independent "dead" representation of the source code.
> > When we finally do parser/compiler integration we probably should
> > revisit this literal/wrapping issue.
> >
> 
> But is is possible to access module/__builtin__module from objspace/std or 
> should complex be moved into the object spaces?

Basically yes, for example 

w_cls = space.getitem(space.w_builtins, self.wrap('complex'))
w_obj = space.call_function(w_cls, space.newfloat(x.real), space.newfloat(x.imag))

    holger



More information about the Pypy-dev mailing list