impl IntoPyException for FormatParseError · RustPython/RustPython@9f8e2af · GitHub
Skip to content

Commit 9f8e2af

Browse files
committed
impl IntoPyException for FormatParseError
1 parent ee90f7c commit 9f8e2af

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

vm/src/format.rs

Lines changed: 6 additions & 7 deletions

vm/src/obj/objstr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use super::objiter;
1919
use super::objnone::PyNone;
2020
use super::objsequence::{PySliceableSequence, SequenceIndex};
2121
use super::objtype::{self, PyClassRef};
22+
use crate::exceptions::IntoPyException;
2223
use crate::format::{FormatSpec, FormatString, FromTemplate};
2324
use crate::function::{OptionalArg, OptionalOption, PyFuncArgs};
2425
use crate::pyobject::{
@@ -590,7 +591,7 @@ impl PyString {
590591
fn format(&self, args: PyFuncArgs, vm: &VirtualMachine) -> PyResult<String> {
591592
match FormatString::from_str(&self.value) {
592593
Ok(format_string) => format_string.format(&args, vm),
593-
Err(err) => Err(err.into_pyobject(vm)),
594+
Err(err) => Err(err.into_pyexception(vm)),
594595
}
595596
}
596597

@@ -602,7 +603,7 @@ impl PyString {
602603
fn format_map(&self, mapping: PyObjectRef, vm: &VirtualMachine) -> PyResult<String> {
603604
match FormatString::from_str(&self.value) {
604605
Ok(format_string) => format_string.format_map(&mapping, vm),
605-
Err(err) => Err(err.into_pyobject(vm)),
606+
Err(err) => Err(err.into_pyexception(vm)),
606607
}
607608
}
608609

vm/src/stdlib/string.rs

Lines changed: 3 additions & 2 deletions

0 commit comments

Comments
 (0)