I'm working on a documentation API for Python I'm calling Python Docs, and I've noticed that almost all built-ins can't be accessed by my static analysis suite, because they are almost exclusively C modules. As far as I can remember, I can't think of any exceptions to this rule.
The first part of my question is simply, does being a built-in module presuppose being a C-extension in CPython?
Assuming that this might be the case, I compiled a fresh pypy runtime and tried using my project against with the built-ins from pypy. I was surprised to find that this didn't work either.
Why aren't PyPy modules available AST objects if they're pure Python? Is this a side-effect of PyPy being hosted on a JIT?
PyPy is two parts -- the Python interpreter and the translation toolchain.
The translation toolchain translates / "compiles" the interpreter from RPython into machine code.
So although PyPy is written in a language that is a subset of Python, it's not Python when you use it.
You should read the compiler section of the PyPy Parser docs and this blog post that describes that the AST features in PyPy mirror those in CPython.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With