Nuitka: 0.6.6
Python: 3.6.9 (default, Nov 23 2019, 06:41:34)
Executable: /usr/local/bin/python
OS: Linux
Arch: x86_64
Nuitka was installed with pip install nuitka
I am using the following to generate modules:
python -m nuitka --module --python-flag=-OO --remove-output --full-compat --lto --output-dir={} {}
All seems to work fine, but I have noticed a difference between the original code and the compiled version, when running the following code:
from app import pipelines
import inspect
for member in inspect.getmembers(pipelines, inspect.isclass):
print(member[1].__module__)
The original code returns app.pipelines.Pipeline, while the compiled one returns Pipeline.
Is this expected behaviour?
Thank you,
Any incompatibility should be unexpected. This was like just wasn't noted before, thanks for the report, should be simple to fix. The question is more, like what Python versions do it in what way, maybe this is a more recent change to Python, sometimes these go unnoticed. I will expand our tests and see what I can do then.
Strange, I did find test coverage for this in programs, but loaded extension modules, do not use their dynamic name for __module__ in classes, but likely the compile time value, which is the bug then, and since your mode of operation is rare (compiling everything on its own instead of making one package with all), that is barely noticed.
Ok, I got a fix, testing it internally first, but basically it replaces the direct constant string for the module name with a node that represents it, and that node gets optimized in programs, but not in modules, instead it remains a run time lookup. I will let you know, when I put out something for you to test. I will not have coverage of your use case, since this is automatic. I think for other things, like __name__ in the module, we already do it like this and it's known to work.
Great news, thank you. Let me know when I can test it and I will report back.
Awesome work, by the way.
Check it out http://nuitka.net/doc/factory.html
Thank you, just tested it and can confirm it works.
This is now on the develop branch, and awaits release.
The release 0.6.8 was just made and contains the correction.