Skip to content

Python 3.10 kwarg peephole rewrite failing in valid case (breaks mainline) #8043

Closed

Description

@stuartarchibald

Reporting a bug

  • I have tried using the latest released version of Numba (most recent is
    visible in the change log (https://github.com/numba/numba/blob/main/CHANGE_LOG).
  • I have included a self contained code sample to reproduce the problem.
    i.e. it's possible to run as 'python bug.py'.

This breaks on mainline and is a blocking issue for 0.56.

from numba import njit, objmode

def func(*args):
    pass

@njit
def log(*args):
    with objmode():
        func(*args)

log()

the above reproducer is extracted from the failing tests found by running on Python 3.10:

./runtests.py numba.tests.test_ndarray_subclasses

Activity

  1. stuartarchibald commented on May 12, 2022

    @stuartarchibald
    ContributorAuthor
  2. stuartarchibald commented on May 12, 2022

    @stuartarchibald
    ContributorAuthor

    Running the above on Python 3.10 results in:

    numba/core/interpreter.py", line 708, in peep_hole_call_function_ex_to_call_function_kw
        raise UnsupportedError(errmsg)
    numba.core.errors.UnsupportedError: Failed in nopython mode pipeline (step: analyzing bytecode)
    
    CALL_FUNCTION_EX with **kwargs not supported.
    If you are not using **kwargs this may indicate that
    you have a large number of kwargs and are using inlined control
    flow. You can resolve this issue by moving the control flow out of
    the function call. For example, if you have
    
        f(a=1 if flag else 0, ...)
    
    Replace that with:
    
        a_val = 1 if flag else 0
        f(a=a_val, ...)
    
  3. njriasan commented on May 12, 2022

    @njriasan
    Contributor

    @stuartarchibald. I'll take a look. Thanks for the ping.

  4. njriasan commented on May 12, 2022

    @njriasan
    Contributor

    @stuartarchibald I found the source of the issue. Opening a PR.

  5. stuartarchibald commented on May 13, 2022

    @stuartarchibald
    ContributorAuthor

    Thanks for promptly taking a look/opening a patch @njriasan, much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions