question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Providing many keyword arguments triggers assertion error with Python 3.10 due to unsupported bytecode

See original GitHub issue

It 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:closed
  • Created 2 years ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
sklamcommented, Feb 4, 2022

@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

0reactions
stuartarchibaldcommented, Mar 14, 2022

Those two previous comments are intended for the PR, not this issue, so I’ll duplicate them there, apologies.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found