mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 11:14:38 +08:00
Fix resource index conversion and REPL warning (#8654)
Accept __index__ values when converting resource limits and only report PyREPL fallback reasons for terminal-backed interactive sessions. Assisted-by: Codex:gpt-5
This commit is contained in:
1 parent
a8aa383c50
commit
c8cc54f49f
2 files changed
+4
-2
No files matched your search
@@ -175,7 +175,7 @@ mod resource {
|
||||
}
|
||||
|
||||
fn py2rlim_limit(obj: &PyObject, vm: &VirtualMachine) -> PyResult<host_resource::rlim_t> {
|
||||
let int = obj.try_to_ref::<crate::vm::builtins::PyInt>(vm)?;
|
||||
let int = obj.try_index(vm)?;
|
||||
if int.as_bigint().is_negative() {
|
||||
return Err(vm.new_value_error("Cannot convert negative int"));
|
||||
}
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user