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

[BUG] Crash on iterating through Python dict with NumPy ndarray value #3522

Open
carlohamalainen opened this issue Sep 22, 2024 · 0 comments
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@carlohamalainen
Copy link

Bug description

Code snippet:

from python import Python

def main():
    var np = Python.import_module("numpy")
    var d = Python.dict()

    d[42] = np.eye(10)

    # meant to write d.items()
    for x in d:
        print(x[1].shape)

Running it crashes:

$ magic run mojo crash_items.mojo
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0.	Program arguments: /Users/carlo/hello-world/.magic/envs/default/bin/mojo crash_items.mojo
mojo crashed!
Please file a bug report.
[72967:1302362:20240922,182610.515462:WARNING in_range_cast.h:38] value -634136515 out of range
[72967:1302362:20240922,182610.518527:WARNING crash_report_exception_handler.cc:257] UniversalExceptionRaise: (os/kern) failure (5)

It doesn't crash if I change the loop to

    for x in d.items():

Steps to reproduce

Just run the code snippet.

$ magic run mojo crash_items.mojo

System information

- What OS did you do install Mojo on ?

macOS 14.6.1 (23G93), Macbook Air M2

- Provide version information for Mojo by pasting the output of `mojo -v`


$ mojo -v
mojo 24.5.0 (e8aacb95)
(hello-world) 
  • Provide Modular CLI version by pasting the output of modular -v
modular -v
zsh: command not found: modular
(hello-world) 

I followed the hello world example in the docs; not sure why there's no modular binary.

@carlohamalainen carlohamalainen added bug Something isn't working mojo-repo Tag all issues with this label labels Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant