[pypy-dev] Rtyping classes definitions?

Niklaus Haldimann nhaldimann at gmx.ch
Tue Apr 4 23:52:43 CEST 2006

Hi Antonio

Antonio Cuni wrote:
> At the moment the only way to access class definitions is by calling
> TranslationContext.annotator.getuserclassdefinitions(), which returns a
> list of ClassDef instances: I've noticed that class attributes are not
> typed but only annotated.
> Obviously for generating CLI classes I need to rtype class definitions,
> so that I can know the exact low-level type of the fields: I wondered if
> the absence of the rtyping step is intended or if it is a thing to do.
> In the latter case I could try to do it (hoping to do better than with
> rlist :-).

There must be a misunderstanding here, the rtyping step is not at all
missing. ;) If you look at rtyped graphs you'll see that instances (and
classes) have low-level types of the ootype.Instance kind. These
Instance types have a _field attribute that is a dict mapping field
names to their low-level types. You should be operating with these
Instance types not with ClassDefs, the latter are mostly an
implementation detail of the annotation phase.


More information about the Pypy-dev mailing list