Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use 1d array containing a single value as a predicate. #4923

Closed
vivekvekariya opened this issue Dec 3, 2019 · 5 comments
Closed

Cannot use 1d array containing a single value as a predicate. #4923

vivekvekariya opened this issue Dec 3, 2019 · 5 comments

Comments

@vivekvekariya
Copy link

Cannot cast array(float64, 1d, C) to bool: %".155" = load {i8*, i8*, i64, i64, double*, [1 x i64], [1 x i64]}, {i8*, i8*, i64, i64, double*, [1 x i64], [1 x i64]}* %"large"

@stuartarchibald
Copy link
Contributor

Thanks for the report. Please could you provide more information about what caused this problem:

  1. The code that you were running (as a minimal working reproducer, if you are unsure how to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).
  2. Any data needed to run the code.
  3. The full trace back of the exception.

Thanks.

@bittremieux
Copy link

@vivekvekariya Are you using Python 3.8? If so, this might be related to #4712.

@vivekvekariya
Copy link
Author

@bittremieux No I am using Python 3.7.4

@stuartarchibald
Copy link
Contributor

stuartarchibald commented Dec 4, 2019

Gitter discussion: https://gitter.im/numba/numba?at=5de6abae46397c721c7e5f17

This is a reproducer:

import numpy as np
from numba import njit

def foo():
    x = np.ones(1)
    if x:
        pass

njit(foo)()

it's the bug fixed by this: #3901 (or related to, may need bool(types.Array(<ty>, 1, <order>)) implementing too).

@stuartarchibald stuartarchibald changed the title Lowering error in Nopython mode Cannot use 1d array containing a single value as a predicate. Dec 4, 2019
@stuartarchibald
Copy link
Contributor

Fixed by #5225, closing.

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

No branches or pull requests

3 participants