[Grok-dev] Grok, python 2.6 and unladen-swallow
hanno at hannosch.eu
Mon Sep 21 15:42:06 EDT 2009
On Mon, Sep 21, 2009 at 9:07 PM, Martijn Faassen <faassen at startifact.com> wrote:
> Anyway, hopefully we'll get unladen swallow support in Grok for free
> once we move to Python 2.6 and someone experiments with it. We'll then
> see whether it matters for them.
I'd be surprised to see any real issues with unladen swallow and Grok.
The one thing they did make sure is to be virtually 100% compatible
with standard Python 2.6.
I was able to run all of Plone, including its vast stack with just two
small changes. All the ZTK underpinnings including their C extensions
worked without changes.
The two things were:
1. they extend the -O command line switch to have a -O3 option. You
need to specify it to benefit from all their speedups. Already on -O2
or -OO Python removes docstrings. There is some code that computes
docstrings via some "string" + otherclass.__doc__ constructs. Run in
-O2 this fails, as this becomes "string" + None and raises an error.
Also the Zope2 ZPublisher "security check" doesn't work, which
prevents methods without a docstring from being published.
2. RestrictedPython has some notion of "safe_builtins", trying to
proxy all builtins with save versions. Unladen swallow introduces some
new internal builtins, which need to be present to execute any code
via eval or exec later on. As with any normal extension of the
builtins in a major Python version, these new builtins need to be
passed through. They have some rather fancy names starting with "#@",
for example "#@make_function", "#@buildclass" and so on. It's quite
tricky to call these from Python code ;-)
On a general note: I do expect to see much more outcome from the
project. They are just still in the early stages, where they focussed
on getting some quick wins out first and now work on the entire Python
to LLVM project. There's lots of potential, but still quite a bit of
More information about the Grok-dev