We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c14e7b0 commit 6cd8644Copy full SHA for 6cd8644
vm/src/stdlib/os.rs
@@ -1696,12 +1696,7 @@ mod _os {
1696
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
1697
match obj.downcast::<int::PyInt>() {
1698
Ok(int) => int::try_to_primitive(int.as_bigint(), vm).map(Self::Val),
1699
- Err(obj) => {
1700
- let cstring = std::ffi::CString::try_from_object(vm, obj)?;
1701
- cstring.into_string().map(Self::Name).map_err(|e| {
1702
- vm.new_os_error(format!("error while parsing string: {:?}", e))
1703
- })
1704
- }
+ Err(obj) => PyStrRef::try_from_object(vm, obj).map(|o| Self::Name(o.to_string())),
1705
}
1706
1707
0 commit comments