Open anki-code opened 3 years ago
Hi!
If we convert Python code to the binary using Nuitka LazyObject raises error when it converts to dict.
LazyObject
Example (lazy.py):
from lazyasd import LazyObject VAR = LazyObject(lambda: {"answer": 42}, globals(), 'VAR') print(type(VAR), dict(VAR)) print(type(VAR), VAR)
Run:
pip install lazyasd nuitka # Works perfect in Python python lazy.py # <class 'lazyasd.LazyObject'> {'answer': 42} # <class 'dict'> {'answer': 42} # Not working in Nuitka python -m nuitka lazy.py ./lazy.bin #Traceback (most recent call last): # File "/tmp/lazy.py", line 5, in <module> # print(type(VAR), dict(VAR)) # File "/opt/miniconda/lib/python3.8/site-packages/lazyasd.py", line 64, in __getattribute__ # obj = self._lazy_obj() # File "/opt/miniconda/lib/python3.8/site-packages/lazyasd.py", line 63, in __getattribute__ # return super().__getattribute__(name) #AttributeError: 'method-wrapper' object has no attribute '_lazy_obj'
Another use cases of LazyObject are look working (but require more testing).
More info:
⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment
+1
Hi!
If we convert Python code to the binary using Nuitka
LazyObject
raises error when it converts to dict.Example (lazy.py):
Run:
Another use cases of
LazyObject
are look working (but require more testing).More info:
For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 comment