We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This shouldn't make it through typing but it does
from numba import njit import numpy as np @njit def foo(x): for i in range(x): print(i) foo(12.3)
range() should not accept a floating point value. This types as:
range()
----------------------------------IR DUMP: foo---------------------------------- label 0: x = arg(0, name=x) ['x'] jump 2 [] label 2: $4load_global.0 = global(range: <class 'range'>) ['$4load_global.0'] $8call_function.2 = call $4load_global.0(x, func=$4load_global.0, args=[Var(x, range_issue.py:6)], kws=(), vararg=None) ['$4load_global.0', '$8call_function.2', 'x'] del x [] del $4load_global.0 [] $10get_iter.3 = getiter(value=$8call_function.2) ['$10get_iter.3', '$8call_function.2'] del $8call_function.2 [] $phi12.0 = $10get_iter.3 ['$10get_iter.3', '$phi12.0'] del $10get_iter.3 [] jump 12 [] label 12: $12for_iter.1 = iternext(value=$phi12.0) ['$12for_iter.1', '$phi12.0'] $12for_iter.2 = pair_first(value=$12for_iter.1) ['$12for_iter.1', '$12for_iter.2'] $12for_iter.3 = pair_second(value=$12for_iter.1) ['$12for_iter.1', '$12for_iter.3'] del $12for_iter.1 [] $phi14.1 = $12for_iter.2 ['$12for_iter.2', '$phi14.1'] del $12for_iter.2 [] branch $12for_iter.3, 14, 26 ['$12for_iter.3'] label 14: del $12for_iter.3 [] i = $phi14.1 ['$phi14.1', 'i'] del $phi14.1 [] $16load_global.2 = global(print: <built-in function print>) ['$16load_global.2'] del $16load_global.2 [] print(i) ['i'] del i [] $20call_function.4 = const(NoneType, None) ['$20call_function.4'] del $20call_function.4 [] jump 12 [] label 26: del $phi14.1 [] del $phi12.0 [] del $12for_iter.3 [] jump 28 [] label 28: $const28.0 = const(NoneType, None) ['$const28.0'] $30return_value.1 = cast(value=$const28.0) ['$30return_value.1', '$const28.0'] del $const28.0 [] return $30return_value.1 ['$30return_value.1'] -----------------------------------propagate------------------------------------ ---- type variables ---- [$10get_iter.3 := range_iter_int32, $12for_iter.1 := pair<int32, bool>, $12for_iter.2 := int32, $12for_iter.3 := bool, $16load_global.2 := Function(<built-in function print>), $20call_function.4 := none, $30return_value.1 := none, $4load_global.0 := Function(<class 'range'>), $8call_function.2 := range_state_int32, $const28.0 := none, $phi12.0 := range_iter_int32, $phi14.1 := int32, arg.x := float64, i := int32, x := float64] -----------------------------------propagate------------------------------------ ---- type variables ---- [$10get_iter.3 := range_iter_int32, $12for_iter.1 := pair<int32, bool>, $12for_iter.2 := int32, $12for_iter.3 := bool, $16load_global.2 := Function(<built-in function print>), $20call_function.4 := none, $30return_value.1 := none, $4load_global.0 := Function(<class 'range'>), $8call_function.2 := range_state_int32, $const28.0 := none, $phi12.0 := range_iter_int32, $phi14.1 := int32, arg.x := float64, i := int32, x := float64] ---------------------------------Variable types--------------------------------- {'$10get_iter.3': range_iter_int32, '$12for_iter.1': pair<int32, bool>, '$12for_iter.2': int32, '$12for_iter.3': bool, '$16load_global.2': Function(<built-in function print>), '$20call_function.4': none, '$30return_value.1': none, '$4load_global.0': Function(<class 'range'>), '$8call_function.2': range_state_int32, '$const28.0': none, '$phi12.0': range_iter_int32, '$phi14.1': int32, 'arg.x': float64, 'i': int32, 'x': float64} ----------------------------------Return type----------------------------------- none -----------------------------------Call types----------------------------------- {call $4load_global.0(x, func=$4load_global.0, args=[Var(x, range_issue.py:6)], kws=(), vararg=None): (int32,) -> range_state_int32, getiter(value=$8call_function.2): (range_state_int32,) -> range_iter_int32, iternext(value=$phi12.0): (range_iter_int32,) -> pair<int32, bool>, <numba.ir.Print object at 0x7fb8630b1810>: (int32,) -> none}
The text was updated successfully, but these errors were encountered:
Likely because of implicit cast from float to int
Sorry, something went wrong.
No branches or pull requests
Reporting a bug
latest releasedmaster version of Numba (most recent is visible inthe change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).
This shouldn't make it through typing but it does
range()
should not accept a floating point value. This types as:The text was updated successfully, but these errors were encountered: