Providing many keyword arguments triggers assertion error with Python 3.10 due to unsupported bytecode
See original GitHub issueIt seems that Python 3.10 produces a different bytecode instruction, CALL_FUNCTION_EX when using a large number of keyword arguments. From my testing it seems like this occurs once you reach 16 keyword arguments. I only see this behavior on Python 3.10 and not Python 3.9. Here is a reproducer:
import numba
@numba.njit
def my_func1(a=None, b=None, c=None, d=None, e=None, f=None, g=None, h=None, i=None, j=None, k=None, l=None, m=None, n=None, o=None, p=None):
return my_func2(
a=a,
b=b,
c=c,
d=d,
e=e,
f=f,
g=g,
h=h,
i=i,
j=j,
k=k,
l=l,
m=m,
n=n,
o=o,
p=p
)
@numba.njit
def my_func2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p):
return
print(my_func1())
Issue Analytics
- State:
- Created 2 years ago
- Comments:20 (20 by maintainers)
Top Results From Across the Web
What's New In Python 3.8 — Python 3.11.1 documentation
There is a new function parameter syntax / to indicate that some function parameters must be specified positionally and cannot be used as...
Read more >Changelog — Python 3.11.1 documentation
To fix the race condition, the thread which requested the GIL drop now resets its request before exiting. Issue discovered and analyzed by...
Read more >inspect — Inspect live objects — Python 3.11.1 documentation
The inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, ...
Read more >Issue 34880: About the "assert" bytecode - Python tracker
2 ``` `assert` implicitly invokes `AssertionError`, ... That is to say, simply changing a global variable breaks the work of a keyword.
Read more >List of issues - Issues with patch - Python tracker
ID Activity Status Creator
45950 7 months ago open christian.heimes
45847 7 months ago open christian.heimes
45193 7 months ago open taleinat
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 Free
Top 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

@njriasan, we are referring to rewriting the bytecode sequence as part of
interpreter.py. An example of the rewrite can be find at:https://github.com/numba/numba/blob/d9efc9ebce26c61eee2b3665144d0e321327131e/numba/core/interpreter.py#L82
Those two previous comments are intended for the PR, not this issue, so I’ll duplicate them there, apologies.