modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
23.29k stars 2.59k forks source link

[BUG]: Mojo does not support Python nested lists? #1056

Open shepf opened 1 year ago

shepf commented 1 year ago

Bug description

Error printing Python nested list in Mojo environment, no error reported in normal Python environment~

Steps to reproduce

mojo:

nested_list = [[1, 2], [3, 4], [5, 6]]

print(nested_list)

[User] error: wrapped Expression [11]:6:1: no viable expansions found fn __lldb_expr11(inout mojo_repl_arg: mojo_repl_context): ^

wrapped Expression [11]:8:28: call expansion failed - no concrete specializations mojo_repl_expr_impl(mojo_repl_arg, __get_address_as_lvalue(mojo_repl_arg.ar.load().address), get_address_as_lvalue(mojo_repl_arg.np.load().address), get_address_as_lvalue(mojo_repl_arg.nested_list.load().address)) ^

wrapped Expression [11]:12:1: no viable expansions found def mojo_repl_expr_impl(inout mojo_repl_arg: mojo_repl_context, inout ar: __mlir_type.!kgen.declref<@"$python"::@"$object"::@PythonObject>, inout np: mlir_type.!kgen.declref<@"$python"::@"$object"::@PythonObject>, inout nested_list: __mlir_type.!kgen.declref<@"$builtin"::@"$builtin_list"::@ListLiteral<_18x21_Ts: variadic<type> = [@"$builtin"::@"$builtin_list"::@ListLiteral<_18x21_Ts: variadic<type> = [!kgen.declref<@"$builtin"::@"$int"::@Int>, !kgen.declref<@"$builtin"::@"$int"::@Int>]>, @"$builtin"::@"$builtin_list"::@ListLiteral<_18x21_Ts: variadic<type> = [!kgen.declref<@"$builtin"::@"$int"::@Int>, !kgen.declref<@"$builtin"::@"$int"::@Int>]>, @"$builtin"::@"$builtin_list"::@ListLiteral<_18x21_Ts: variadic<type> = [!kgen.declref<@"$builtin"::@"$int"::@Int>, !kgen.declref<@"$builtin"::@"$int"::@Int>]>]>>) -> None: ^

wrapped Expression [11]:19:26: call expansion failed - no concrete specializations __mojo_repl_expr_body__() ^

wrapped Expression [11]:14:3: no viable expansions found def __mojo_repl_expr_body__() -> None: ^

Expression [11]:2:7: call expansion failed - no concrete specializations print(nested_list) ^

expression failed to parse (no further compiler diagnostics)

System information

- What OS did you do install Mojo on ?
- Provide version information for Mojo by pasting the output of `mojo -v`
- Provide Modular CLI version by pasting the output of `modular -v`

root@good:~# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

root@good:~# mojo -v
mojo 0.4.0 (9e33b013)
root@good:~# modular -v
modular 0.2.0 (355ea9c0)
Mogball commented 1 year ago

This is a known issue and we're working on it. Thanks for reporting!