Visitar URL original
Python 2.7 heterogeneous list unbox problem · Issue #4087 · numba/numba · GitHub
Skip to content

Python 2.7 heterogeneous list unbox problem #4087

Closed

Description

@stuartarchibald

Reporting a bug

Python 2.7 has an issue with this:

from numba import njit
import numpy as np

@njit
def foo(arg1, arg2):
    return 10

a = [np.array([ True]), np.array([False,  True, False])]
b = [np.array([1]), np.array([[ 0,  1,  2]])]

try:
    print(foo(1, b)) # ok, TypeError
except TypeError:
    pass
print(foo(a, b)) # broken

which gives:

test_pr_4077.py:15: RuntimeWarning: tp_compare didn't return -1 or -2 for exception                                             
  print(foo(a, b)) # broken                                                                                                     
Traceback (most recent call last):                                                                                              
  File "test_pr_4077.py", line 15, in <module>                                                                                  
    print(foo(a, b)) # broken                                                                                                   
SystemError: NULL result without error in PyObject_Call   

seems like it's the unbox of the second list that's the problem where it types it as a types.List(types.Array(int64, 1,'C')) but the second element is a 2d array. Why it only impacts the second use case and Python 2.7 (3.x is fine) needs more investigation.

Activity

  1. stuartarchibald commented on Feb 6, 2020

    @stuartarchibald
    ContributorAuthor

    Python 2.7 reached EOL on January 1st, 2020 and Numba 0.47 was the last release to support Python 2.7. Closing this issue as it is Python 2.7 specific, if this problem is reproducible on Python 3 with Numba >= 0.48 then please reopen it. Many thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions