diff --git a/crates/stdlib/src/resource.rs b/crates/stdlib/src/resource.rs index 7e0523b78..9ee97ed5a 100644 --- a/crates/stdlib/src/resource.rs +++ b/crates/stdlib/src/resource.rs @@ -175,7 +175,7 @@ mod resource { } fn py2rlim_limit(obj: &PyObject, vm: &VirtualMachine) -> PyResult { - let int = obj.try_to_ref::(vm)?; + let int = obj.try_index(vm)?; if int.as_bigint().is_negative() { return Err(vm.new_value_error("Cannot convert negative int")); } diff --git a/src/lib.rs b/src/lib.rs index 62ba14c2b..5da2058ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -361,7 +361,9 @@ fn run_rustpython(vm: &VirtualMachine, run_mode: RunMode) -> PyResult<()> { RunMode::Repl => Ok(()), }; let result = if is_repl || vm.state.config.settings.inspect { - warn_if_pyrepl_unavailable(vm); + if std::io::stdin().is_terminal() { + warn_if_pyrepl_unavailable(vm); + } shell::run_shell(vm, scope) } else { res