[pypy-dev] How does RPython read "live objects" from Python

Albert Zeyer albzey at googlemail.com
Thu Jun 20 18:00:09 CEST 2013


When you run Python code, once the Python interpreter encounters a
function definition, it automatically compiles it to Python bytecode.
That's nothing specific to RPython. Also, decorators are only
syntactic sugar and are also just executed by Python itself (refer to
the Python docs).

The bytecode of a function can also be accessed (read-only) via
`func.func_code.co_code` - it's just a binary string. `func.func_code`
itself is an code-object (refer to the Python docs). You can use the
`dis` module to get a human-readable version of the bytecode.



On Thu, Jun 20, 2013 at 5:43 PM, Radek Falhar <radek.falhar at hotmail.com> wrote:
> I started studying RPython and I find it's way of metaprogramming through
> first running Python interpret over source and then compiling from
> internally generated objects interesting.
> I would like to ask how does RPython do it exactly? Where can I find it in
> RPython's compiler and if there is more detailed information about this
> practice?
>
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev
>


More information about the pypy-dev mailing list