Nuitka Release 0.3.19
This is to inform you about the new stable release of Nuitka. It is the extremely compatible Python compiler, “download now”.
This time there are a few bug fixes, major cleanups, more Python3 support, and even new features. A lot things in this are justifying a new release.
Bug fixes
The man pages of
nuitkaandnuitka-pythonhad no special layout for the option groups and broken whitespace for--recurse-tooption. Also--g++-onlywas only partially bold. Released as 0.3.18.1 hot fix already.The command line length improvement we made to Scons for Windows was not portable to Python2.6. Released as 0.3.18.2 hot fix already.
Code to detect already considered packages detection was not portable to Windows, for one case, there was still a use of
/instead of using ajoinpathcall. Released as 0.3.18.3 already.A call to the range built-in with no arguments would crash the compiler, see Released as 0.3.18.4 already.
Compatibility Fix: When rich comparison operators returned false value other
False, for comparison chains, these would not be used, butFalseinstead, see .The support for
__import__didn’t cover keyword arguments, these were simply ignored. Fixed, but no warning is given yet.
New Features
A new option has been added, one can now specify
--recurse-directoryand Nuitka will attempt to embed these modules even if not obviously imported. This is not yet working perfect yet, but will receive future improvements.Added support for the
execbuilt-in of Python3, this enables us to run one more basic test,GlobalStatement.pywith Python3. The testExecEval.pynearly works now.
Optimization
The no arguments
range()call now optimized into the static CPython exception it raises.Parts of comparison chains with constant arguments are now optimized away.
Cleanups
Simplified the
CPythonExpressionComparisonnode, it now always has only 2 operands.If there are more, the so called “comparison chain”, it’s done via
andwith assignments to temporary variables, which are expressed by a new node typeCPythonExpressionTempVariableRef. This allowed to removeexpression_tempsfrom C++ code templates and generation, reducing the overall complexity.When executing a module (
--executebut not--exe), no longer does Nuitka import it into itself, instead a new interpreter is launched with a fresh environment.The calls to the variadic
MAKE_TUPLEwere replaced with calls theMAKE_TUPLExx(wherexxis the number of arguments), that are generated on a as-needed basis. This gives more readable code, because noEVAL_ORDERED_xxis needed at call site anymore.Many node classes have moved to new modules in
nuitka.nodesand grouped by theme. That makes them more accessible.The choosing of the debug python has moved from Scons to Nuitka itself. That way it can respect the
sys.abiflagsand works with Python3.The replacing of
.pyin filenames was made more robust. No longer isstr.replaceused, but instead proper means to assure that having.pyas other parts of the filenames won’t be a trouble.Module recursion was changed into its own module, instead of being hidden in the optimization that considers import statements.
As always, some PyLint work, and some minor
TODOwere solved.
Organisational
Added more information to the Developer Manual, e.g. documenting the tree changes for
assertto become a conditional statement with a raise statement, etc.The Debian package is as of this version verified to be installable and functional on to Ubuntu Natty, Maverick, Oneiric, and Precise.
Added support to specify the binary under test with a
NUITKAenvironment, so the test framework can run with installed version of Nuitka too.Made sure the test runners work under Windows as well. Required making them more portable. And a workaround for
os.execlnot propagating exit codes under Windows.For windows target the MinGW library is now linked statically. That means there is no requirement for MinGW to be in the
PATHor even installed to execute the binary.
New Tests
The
basic,programs,syntax, andreflectedwere made executable under Windows. Occasionally this meant to make the test runners more portable, or to work around limitations.Added test to cover return values of rich comparisons in comparison chains, and order of argument evaluation for comparison chains.
The
Referencing.pytest was made portable to Python3.Cover no arguments
range()exception as well.Added test to demonstrate that
--recurse-directoryactually works. This is using an__import__that cannot be predicted at run time (yet).The created source package is now tested on pbuilder chroots to be pass installation and the basic tests, in addition to the full tests during package build time on these chroots. This will make sure, that Nuitka works fine on Ubuntu Natty and doesn’t break without notice.
Summary
This releases contains many changes. The “temporary variable ref” and “assignment expression” work is ground breaking. I foresee that it will lead to even more simplifications of code generation in the future, when e.g. in-place assignments can be reduced to assignments to temporary variables and conditional statements.
While there were many improvements related to Windows support and fixing portability bugs, or the Debian package, the real focus is the optimization work, which will ultimately end with “value propagation” working.
These are the real focus. The old comparison chain handling was a big wart. Working, but no way understood by any form of analysis in Nuitka. Now they have a structure which makes their code generation based on semantics and allows for future optimization to see through them.
Going down this route is an important preparatory step. And there will be more work like this needed. Consider e.g. handling of in-place assignments. With an “assignment expression” to a “temporary variable ref”, these become the same as user code using such a variable. There will be more of these to find.
So, that is where the focus is. The release now was mostly aiming at
getting involved fixes out. The bug fixed by comparison chain reworking,
and the __import__ related one, were not suitable for hot fix
releases, so that is why the 0.3.19 release had to occur now. But with
plugin support, with this comparison chain cleanup, with improved
Python3 support, and so on, there was plenty of good stuff already, also
worth to get out.