mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Fix bug where [::0] did not throw ValueError
This commit is contained in:
@@ -363,7 +363,7 @@ impl PyRange {
|
||||
};
|
||||
|
||||
let new_step = if let Some(int) = slice.step_index(vm)? {
|
||||
if step.is_zero() {
|
||||
if int.is_zero() {
|
||||
return Err(vm.new_value_error("slice step cannot be zero".to_string()));
|
||||
} else {
|
||||
PyInt::new(int * self.step.as_bigint()).into_ref(vm)
|
||||
|
||||
Reference in New Issue
Block a user