Skip to content

Commit ec7334c

Browse files
coolreader18youknowone
authored andcommitted
Fix compilation without compiler feature
1 parent a5ad950 commit ec7334c

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

stdlib/src/dis.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,23 @@ mod decl {
1313
let co = if let Ok(co) = obj.get_attr("__code__", vm) {
1414
// Method or function:
1515
PyRef::try_from_object(vm, co)?
16-
} else if let Ok(_co_str) = PyStrRef::try_from_object(vm, obj.clone()) {
16+
} else if let Ok(co_str) = PyStrRef::try_from_object(vm, obj.clone()) {
1717
#[cfg(not(feature = "compiler"))]
18-
return Err(vm.new_runtime_error(
19-
"dis.dis() with str argument requires `compiler` feature".to_owned(),
20-
));
18+
{
19+
let _ = co_str;
20+
return Err(vm.new_runtime_error(
21+
"dis.dis() with str argument requires `compiler` feature".to_owned(),
22+
));
23+
}
2124
#[cfg(feature = "compiler")]
22-
vm.compile(
23-
_co_str.as_str(),
24-
crate::vm::compiler::Mode::Exec,
25-
"<dis>".to_owned(),
26-
)
27-
.map_err(|err| vm.new_syntax_error(&err, Some(_co_str.as_str())))?
25+
{
26+
vm.compile(
27+
co_str.as_str(),
28+
crate::vm::compiler::Mode::Exec,
29+
"<dis>".to_owned(),
30+
)
31+
.map_err(|err| vm.new_syntax_error(&err, Some(co_str.as_str())))?
32+
}
2833
} else {
2934
PyRef::try_from_object(vm, obj)?
3035
};

0 commit comments

Comments
 (0)