[pypy-dev] rlib parsing

Ian Overgard ian.overgard at gmail.com
Thu Apr 21 17:31:42 CEST 2011


Doh, it turns out you're right, it is valid rpython, the problem was
elsewhere. I was assuming the transform function was at fault because the
error only happened when that was included in the build. It turns out
correlation doesn't equal causation :-)

The actual bug was this:

[translation:ERROR]  Exception': found an operation that always raises
AttributeError: generated by a constant operation:  getattr(<AliasModule
'py.test' for 'pytest'>, 'config')

Which I managed to fix by putting this lovely hack at the top of my script:

class FixConfig:
    class option:
        view = False
py.test.config = FixConfig



Everything seems to be working now. Thanks to both Carl and Leonardo for the
help!

On Wed, Apr 20, 2011 at 3:33 AM, Carl Friedrich Bolz <cfbolz at gmx.de> wrote:

> On 04/20/2011 12:51 AM, Ian Overgard wrote:
> > Thanks, that definitely helped. I forgot you could run arbitrary python
> > before the entry point.
> >
> > I've got it parsing now, but the one issue I'm still running into is
> > that the syntax tree that comes back has a lot of junk nodes. The
> > ToAST.transform function will clean them up, but it seems to be
> > not-rpython, and I don't think there's any way I can call it before the
> > entry point (since it's processing the ast, not the grammar).
> >
> > Is that class just hopeless? Or is there some way I can annotate it
> > myself in the code? (
>
> You could take a look at the test test_translate_ast_visitor in
> rlib/parsing/test/test_translate.py. It does what you need to do by
> explicitly calling visit_[initial rule] on the AST visitor. I tried to
> replace that with a call to transform and it still worked. So I don't
> know what you are doing differently from that test.
>
> Carl Friedrich
> _______________________________________________
> pypy-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110421/6075eb77/attachment.html>


More information about the Pypy-dev mailing list