`del` on local variable `setup_rt` yields `UnboundLocalError: local variable 'setup_rt' referenced before assignment`
See original GitHub issue- Nuitka version, full Python version and Platform (Windows, OSX, Linux …)
> /opt/conda/bin/python -m nuitka --version
0.6.9rc1
Python: 3.7.4 (default, Aug 13 2019, 15:17:50)
Executable: /opt/conda/bin/python
OS: Darwin
Arch: x86_64
- How did you install Nuitka and Python (pip, anaconda, deb, rpm, from source, what is a virtualenv …), this is very important usually.
/opt/conda/bin/python -m pip install -U "https://github.com/Nuitka/Nuitka/archive/develop.zip"
- Many times when you get an error from Nuitka, your setup may be so special that even a “hello world” program will not work, please try that and report it instead.
Hello world-style programs and more complex programs work. Commenting out the failing line - line 140 - resolves the issue as well.
- If possible please supply a Short, Self Contained, Correct, Example that demonstrates the issue i.e a small piece of code which reproduces the issue and can be run with out any other (or as few as possible) external dependencies.
First install ruamel.yaml version 0.16.10 and then create the following test.py
:
from ruamel.yaml import YAML
if __name__ == "__main__":
print(YAML())
Compiled using /opt/conda/bin/python3 -m nuitka --no-pyi-file --python-flag=no_site --plugin-enable=pylint-warnings --remove-output --nofollow-imports --show-scons --standalone --clang --include-module=ruamel.yaml test.py
This yields the following output when running test.dist/test
:
Traceback (most recent call last):
File "/Users/alash/git/minimal/test.dist/test.py", line 4, in <module>
File "/Users/alash/git/minimal/test.dist/ruamel/yaml/main.py", line 140, in __init__
UnboundLocalError: local variable 'setup_rt' referenced before assignment
The same error is yielded with:
/opt/conda/bin/python3 -m nuitka --follow-import-to=ruamel.yaml --follow-import-to=ruamel test.py && ./test.bin
No errors running:
/opt/conda/bin/python3 -m nuitka --nofollow-imports test.py && ./test.bin
/opt/conda/bin/python3 test.py
I tried but was unable to come up with a simpler reproduction that does not involve ruamel.yaml
.
- If this is a regression (used to work in an earlier version of Nuitka), please note what you know about that.
Did not work on 0.6.7 either; same error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
This must be a recent regression, I think previously a
del
precluded from C boolean shape, and therefore the buggy code was dead. I pushed a fix to factory and will consider making a hotfix later today.That’s absolutely perfect @abl and makes a fix easy I believe. Expect one later today.