Python3 syntax for *args notation of base classes raises an assertion in Nuitka
See original GitHub issueVersions:
- Nuitka 0.5.29.4
- Python 3.6.5
- MacOS 10.13.4
Installed Nuitka with python3 -m pip install nuitka
.
Problem
bases.py
:
class A: pass
class B: pass
bases = (A, B)
class C(*bases): pass
Verbose output:
% python3 -m nuitka --verbose bases.py
Nuitka:WARNING:Problem at '<SourceCodeReference to bases.py:6>' with Starred(value=Name(id='bases', ctx=Load()), ctx=Load()).
Nuitka:WARNING:Problem at '<SourceCodeReference to bases.py:6>' with ClassDef(name='C', bases=[Starred(value=Name(id='bases', ctx=Load()), ctx=Load())], keywords=[], body=[Pass()], decorator_list=[]).
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/nuitka/__main__.py", line 213, in <module>
main()
File "/usr/local/lib/python3.6/site-packages/nuitka/__main__.py", line 207, in main
MainControl.main()
File "/usr/local/lib/python3.6/site-packages/nuitka/MainControl.py", line 758, in main
filename = filename
File "/usr/local/lib/python3.6/site-packages/nuitka/MainControl.py", line 78, in createNodeTree
is_main = not Options.shallMakeModule()
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/Building.py", line 1100, in buildModuleTree
is_main = is_main
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/Building.py", line 1044, in createModuleTree
is_main = is_main
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/Building.py", line 748, in buildParseTree
source_ref = source_ref
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/TreeHelpers.py", line 351, in buildStatementsNode
statements = buildNodeList(provider, nodes, source_ref, allow_none = True)
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/TreeHelpers.py", line 305, in buildNodeList
entry = buildNode(provider, node, node_source_ref, allow_none)
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/TreeHelpers.py", line 262, in buildNode
source_ref = source_ref
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/ReformulationClasses.py", line 920, in buildClassNode
return _buildClassNode3(provider, node, source_ref)
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/ReformulationClasses.py", line 334, in _buildClassNode3
source_ref
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/TreeHelpers.py", line 305, in buildNodeList
entry = buildNode(provider, node, node_source_ref, allow_none)
File "/usr/local/lib/python3.6/site-packages/nuitka/tree/TreeHelpers.py", line 276, in buildNode
assert False, ast.dump(node)
AssertionError: Starred(value=Name(id='bases', ctx=Load()), ctx=Load())
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Nuitka/Developer_Manual.rst at develop - GitHub
The purpose of this Developer Manual is to present the current design of Nuitka, the project rules, and the motivations for choices made....
Read more >Assertions in Python 3 - Tutorialspoint
If the expression is false, Python raises an AssertionError exception. The syntax for assert is: assert Expression[, Arguments].
Read more >cmd2 Documentation
base class cmd.emptyline() method never gets called and thus the empty line behavior cannot be overridden. Cmd.identchars.
Read more >Programming FAQ — Python 3.11.1 documentation
How can I organize my code to make it easier to change the base class? How do I create static class data and...
Read more >Python 3 Q & A
The implicit nature of the conversions in Python 2 also means that encoding operations may raise decoding errors and vice-versa, depending on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, indeed, it is using eval, and therefore effectively not testing Nuitka for real. That is why there is a script that parses docstrings and creates code from it, e.g. like this:
http://nuitka.net/gitweb/?p=tests-Nuitka-CPython.git;a=blob_plain;f=doctest_generated/test_metaclass.py;hb=refs/heads/CPython36
Essentially just output an exception if any for every statement and output everything that is an expression. With this simple approach, I am getting this covered too.
The list of doctests is manually maintained though.
Anyway, I did the hotfix, there was something for Windows to be fixed so I did one still.
That was really fast, thank you!