I've had this issue when trying to use matplotlib for a while, do you know what it could be? I am running the latest version.
0.6.4
Python: 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
Executable: C:\Program Files\Python37\python.exe
OS: Windows
Arch: x86_64
cl /Fowallet.build\module.__main__.obj /c "wallet.build\module.__main__.cpp" /TP /nologo /EHsc /J /Gd /Ox /MT /D_NUITKA_STANDALONE /D_NUITKA_SYSFLAG_BYTES_WARNING=0 /D_NUITKA_SYSFLAG_NO_SITE=0 /D_NUITKA_SYSFLAG_VERBOSE=0 /D_NUITKA_SYSFLAG_UTF8=0 /D_NUITKA_SYSFLAG_OPTIMIZE=0 /D__NUITKA_NO_ASSERT__ /D_NUITKA_CONSTANTS_FROM_RESOURCE /D_NUITKA_FROZEN=168 /D_NUITKA_MODULE_COUNT=1548 /D_NUITKA_EXE "/IC:\Program Files\Python37\include" "/IC:\Program Files\Python37\PC" /Iwallet.build "/IC:\Program Files\Python37\lib\site-packages\nuitka\build\include" "/IC:\Program Files\Python37\lib\site-packages\nuitka\build\static_src"
wallet.build\module.__main__.cpp(89927): error C2440: '=': cannot convert from 'PyObject *' to 'nuitka_bool'
wallet.build\module.__main__.cpp(89927): note: There is no context in which this conversion is possiblescons: *** [wallet.build\module.__main__.obj] Error 2
I really would love to see the main program that causes this. Seems like a missing case for C book usage.
We also have an issue with the wrong plugins versions (among them numpy) taken for the current release I had to learn late yesterday. Probably was me not picking the right repository (#422, @yoshihingis is still testing a workaround)
I will produce the minimum working example and get back
I have been trying to reduce the problem whole day, compiling over and over and I could not isolate it. So I will give you the full thing:
This is the file I am trying to compile:
https://github.com/bismuthfoundation/Bismuth/blob/master/wallet.py
There are lines that say """nuitka, if you remove the comments and restore that code, it will fail compilation on Windows. I tried randomly, and for example uncommenting def themes(theme): will trigger this.
My nuitka: python -m nuitka --follow-imports wallet.py --windows-icon=graphics\icon.ico --standalone --show-progress -j 8 --recurse-all --include-package=coincurve --plugin-enable=tk-inter
Sorry about the poor code structuring
This might be related to me using Microsoft Visual Studio too
I managed to reproduce it just now, luckily not at all dependent on OS or compiler, this is with Linux and gcc. I will keep you posted. These issues have highest priority of course.
For optimization bugs, they can be a bit hard to get a grip on them, because code you remove can allow or forbid them easily. Thanks for your time to work on reducing it. I will keep you posted.
Or, this is the guilty code:
def themes():
if theme == "Barebone" or None:
return None
Change that or None to or False and Nuitka will happily do it.Of course you can also remove it, as it's not having any impact at all. Seems the constant code generation for None is not the best, and also it seems that is something Nuitka should have optimized away.
Yes, code generation for None constant didn't take into account the C target type bool, and that was caught be the C compiler only. Same was the case for Ellipsis.
So, the factory branch has the fixes for the wrong code generation. In terms of resulting binary, in case of "None", the C compiler removes that or through its static analysis, in other cases, e.g. "" it will not (but doesn't give the compilation error).
I think it is well understood that we ought to the optimization phase to provide a target type context, e.g. bool, so that these values can lower themselves to either True or False if possible, but that is a harder change not yet happening.
I see, that condition of mine is unintended anyway, should have been if theme == "Barebone" or theme == None: or ideally if theme == "Barebone" or not theme: I am testing your solution right now, I think this might be it. You're a hero, thank you!
The fix is in Nuitka 0.6.5rc2
Released as 0.6.5