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
On 04/20/2011 12:51 AM, Ian Overgard wrote:You could take a look at the test test_translate_ast_visitor in
> 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? (
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@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev