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

Reaching too deep in import resolution #41

Open
pasteley opened this issue May 28, 2023 · 0 comments
Open

Reaching too deep in import resolution #41

pasteley opened this issue May 28, 2023 · 0 comments

Comments

@pasteley
Copy link

pasteley commented May 28, 2023

Hello
Look like pylyzer is missing limit on nesting import and in complex projects with multiple imports crawling even into std library and crashes there:

Start checking: main.py
...
Start checking: common.py
Start checking: getpass.py
Start checking: contextlib.py
thread 'main' panicked at 'internal error: entered unreachable code', /Users/pasteley/.cargo/registry/src/github.com-1ecc6299db9ec823/erg_compiler-0.6.14-nightly.0/declare.rs:299:43
stack backtrace:
   0:        0x100ff1bd8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h554558af9dcaf5d8
   1:        0x101008c6c - core::fmt::write::h503a82454aa26fb4
   2:        0x100fd771c - std::io::Write::write_fmt::he97d6853eddb17d2
   3:        0x100ff19e8 - std::sys_common::backtrace::print::h669032be8d7b2a7c
   4:        0x100fdef74 - std::panicking::default_hook::{{closure}}::h974276930a474e6a
   5:        0x100fdec38 - std::panicking::default_hook::hb0d2c45a1e792803
   6:        0x100fdf660 - std::panicking::rust_panic_with_hook::hf3b9a3e44fe5f275
   7:        0x100ff2564 - std::panicking::begin_panic_handler::{{closure}}::ha19c90e1160a0cf9
   8:        0x100ff1d18 - std::sys_common::backtrace::__rust_end_short_backtrace::h3f85ad00ac73ff55
   9:        0x100fdf2c0 - _rust_begin_unwind
  10:        0x1010282f0 - core::panicking::panic_fmt::hb0625f6d6e3c09e4
  11:        0x101028360 - core::panicking::panic::h53789822e3a49a18
  12:        0x100e8785c - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::fake_lower_record::ha20de20df591ac8e
  13:        0x100e8aff4 - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::fake_lower_expr::he816d1c4bd79d283
  14:        0x100e84454 - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::fake_lower_call::hf734f43d62012ba1
  15:        0x100e8b1a4 - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::fake_lower_expr::he816d1c4bd79d283
  16:        0x100e89518 - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::fake_lower_params::h28f7bb1ce0b93ae2
  17:        0x100e89c6c - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::fake_lower_lambda::hed460f2cc6e6a353
  18:        0x100e8a8f8 - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::fake_lower_expr::he816d1c4bd79d283
  19:        0x100e8f868 - erg_compiler::declare::<impl erg_compiler::lower::ASTLowerer>::declare_chunk::h42d8bcee330b1beb
  20:        0x100eb043c - erg_compiler::lower::ASTLowerer::lower::h3e04e12f3a1abaeb
  21:        0x100cdffb0 - erg_compiler::build_hir::HIRBuilder::check::h922dbb9789094412
  22:        0x100ce0650 - erg_compiler::build_hir::HIRBuilder::build::hcbd850acbd86e40d
  23:        0x100aa964c - erg_compiler::context::register::<impl erg_compiler::context::Context>::import_mod::h2687e447b2540cfe
  24:        0x100a9ac88 - erg_compiler::context::register::<impl erg_compiler::context::Context>::pre_import::h4ae4d60ff811f652
  25:        0x100a9a8d0 - erg_compiler::context::register::<impl erg_compiler::context::Context>::preregister::h8ff905bceed9eff6
  26:        0x100a9aa50 - erg_compiler::context::register::<impl erg_compiler::context::Context>::preregister::h8ff905bceed9eff6
  27:        0x100eaf9dc - erg_compiler::lower::ASTLowerer::lower::h3e04e12f3a1abaeb
  28:        0x100643fc4 - pylyzer::analyze::PythonAnalyzer::analyze::h5c77832e944fb36a
  29:        0x100644590 - pylyzer::analyze::PythonAnalyzer::run::h85da60a830225d40
  30:        0x1005ab174 - pylyzer::run::h2f5214ce5dcb8f89
  31:        0x100635934 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc9c79afbcee17da6
  32:        0x100653fbc - std::rt::lang_start::{{closure}}::h9d9343ced2be4d6a
  33:        0x100fdd9cc - std::rt::lang_start_internal::h2a63b0d73f6d9885
  34:        0x1005ab258 - _main

os: macOS 13.1
pylyzer: 0.0.29
python: 3.10.7

@pasteley pasteley changed the title Reaching to deep in import resolution Reaching too deep in import resolution May 28, 2023
mtshiba added a commit to erg-lang/erg that referenced this issue May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant