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

Support return int rather than always Optional in dct.get(key, default) #9481

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dlee992
Copy link
Contributor

@dlee992 dlee992 commented Mar 7, 2024

A hacky/flaky way to
fix #9473

This test case can pass:

import numpy as np
from numba import njit
from numba.core import types
from numba.typed import Dict

@njit
def goo(arr):
    d = Dict.empty(types.int64, value_type=types.int64)
    d[0] = 0
    v1 = d.get(0, 0)
    arr[v1] = -1
    v2 = d.get(2, 9)
    arr[v2] = -2
    v3 = d.get(3)
    return arr, v3

arr = np.arange(10)
print(goo(arr))

@sklam
Copy link
Member

sklam commented Mar 12, 2024

We are assuming this PR is still in progress since it does not have a test yet.

@dlee992
Copy link
Contributor Author

dlee992 commented Mar 15, 2024

Hi, test is added @sklam

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

Successfully merging this pull request may close these issues.

want int64 rather than Optional(int64) when dict.get(key, default_int64) and dict value type is int64
3 participants