Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions server/src/core/python_arch_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,24 @@ impl PythonArchBuilder {
}
}
let mut dep_to_add = vec![];
let symbol = import_result.symbol.borrow();
if symbol.typ() != SymType::COMPILED {
for (name, loc_syms) in symbol.iter_symbols() {
if all_name_allowed || name_filter.contains(&name) {
let variable = self.sym_stack.last().unwrap().borrow_mut().add_new_variable(session, OYarn::from(name.clone()), &import_result.range);
let mut loc = variable.borrow_mut();
loc.as_variable_mut().is_import_variable = true;
loc.as_variable_mut().evaluations = Evaluation::from_sections(&symbol, loc_syms);
dep_to_add.push(variable.clone());
let sym_type = import_result.symbol.borrow().typ();
if sym_type != SymType::COMPILED {
if !Rc::ptr_eq(self.sym_stack.last().unwrap(), &import_result.symbol) { /*We have to check that the imported symbol is not the current one. It can
happen for example in a .pyi that is importing the .pyd file with the same name. As both exists, odools will try to import the pyi a second time in the same file,
and so create a borrow error here
*/
let symbol = import_result.symbol.borrow();
for (name, loc_syms) in symbol.iter_symbols() {
if all_name_allowed || name_filter.contains(&name) {
let variable = self.sym_stack.last().unwrap().borrow_mut().add_new_variable(session, OYarn::from(name.clone()), &import_result.range);
let mut loc = variable.borrow_mut();
loc.as_variable_mut().is_import_variable = true;
loc.as_variable_mut().evaluations = Evaluation::from_sections(&symbol, loc_syms);
dep_to_add.push(variable.clone());
}
}
}
}
drop(symbol);
for sym in dep_to_add {
let mut sym_bw = sym.borrow_mut();
let evaluation = &sym_bw.as_variable_mut().evaluations[0];
Expand Down