Skip to content

List.insert() crashes for Numpy arrays #7553

Closed

Description

@ehsantn

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/master/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 code segfaults for me (on Mac OS). Didn't see an obvious issue in insert's implementation with a quick look.

import numpy as np
import numba

@numba.njit
def f():
    l = [np.ones(3)]
    l.insert(0, np.ones(3))
    return l

f()

Activity

  1. ehsantn commented on Nov 11, 2021

    @ehsantn
    ContributorAuthor

    I think I found the issue. The setitem call here decrefs the old value but it shouldn't. I'd be happy to submit a PR if this sounds correct.

    inst.setitem(index, value, incref=True)

  2. esc commented on Nov 12, 2021

    @esc
    Member

    @ehsantn thank you for raising this. Will the suggested fix take care of the segfault? If so, please do prepare a PR so we can run it though CI? What kind of patch would you propose?

    BTW: I can confirm I am able to reproduce this on OSX with Python 3.9 and current HEAD at 5fc9d3c56da4e4c6aef7189e588ce9c44263d4a6.

  3. ehsantn commented on Nov 13, 2021

    @ehsantn
    ContributorAuthor

    Yes, it fixes the segfault. It's a small change. Will open a PR soon.

  4. esc commented on Nov 13, 2021

    @esc
    Member

    Yes, it fixes the segfault. It's a small change. Will open a PR soon.

    Thank you! 🙏

  5. github-actions commented on Dec 14, 2021

    @github-actions

    This issue is marked as stale as it has had no activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with any updates and confirm that this issue still needs to be addressed.

  6. ehsantn commented on Dec 14, 2021

    @ehsantn
    ContributorAuthor

    Linking a pull request doesn't count as activity?

  7. esc commented on Dec 14, 2021

    @esc
    Member

    @ehsantn apparently not, no.

  8. esc commented on Dec 14, 2021

    @esc
    Member

    it was the needtriage label that triggered stale-bot, I have removed it now.

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

    bug - segfaultBugs that cause SIGSEGV, SIGABRT, SIGILL, SIGBUS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions