Repository navigation
Fix overspecialized containers - #6070
Conversation
2746db6 to
235df5e
Compare
| siv_none = siv is None | ||
| oiv_none = oiv is None | ||
| if siv_none and oiv_none: | ||
| return DictType(ukey_type, uvalue_type) |
There was a problem hiding this comment.
ukey_type, uvalue_type are bool
and i think this branch should execute if not siv_none and not oiv_none and the initial value doesn't match
There was a problem hiding this comment.
agree, this a) has bugs and b) is left over from when I was trying to make it do something else! 965a19b fixes.
|
this example contains unify that would fail: from numba import njit
@njit
def bar(x):
o = {1: 2}
if x:
o = {2: 3}
return o
@njit
def foo(x):
if x:
d = {3: 4}
else:
d = bar(x)
return d
foo(1) |
| query_arg.initial_value is None) | ||
| if do_raise: | ||
| loc = first_loc[pos] | ||
| raise errors.ForceLiteralArg(marked_args, loc=loc) |
There was a problem hiding this comment.
Are there tests exercising this branch? I can't seem to find it
There was a problem hiding this comment.
my test here would trigger it but I am not sure if this is useful to raise ForceLiteralArg:
from numba import njit, literally
@njit
def bar(d):
return literally(d)
@njit
def inner(d):
return bar(d)
@njit
def foo(x):
d = {2: x}
return inner(d)
r = foo(123)
print(r)The literal request will never be satisfied it seems.
There was a problem hiding this comment.
try e.g. ./runtests.py numba.tests.test_dictobject.TestTypedDictInitialValues.test_homogeneous_and_literal
?
There was a problem hiding this comment.
That test would pass for me even if the branch is commented out, but it did fail numba.tests.test_dictobject.TestTypedDictInitialValues.test_mutation_not_carried_single_function.
But it seems that it doesn't need to be ForceLiteralArg exception.
There was a problem hiding this comment.
The ForceLiteralArg would likely be useful if prefer_literal=True
No description provided.