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:
Jeong, YunWon authored and GitHub committed 2026-09-05 19:49:56 +09:00
1 parent a8aa383c50
commit c8cc54f49f
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -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
View File
@@ -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