Skip to content

Commit 341789f

Browse files
committed
Update script
1 parent 2c6a68c commit 341789f

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

script/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66

77
[dependencies]
88
thiserror = "1"
9-
rustpython-vm = { git = "https://github.com/RustPython/RustPython.git", rev = "397392c2fd5553a6d2f714e4fdba0df43f3ced52" }
9+
rustpython-vm = { git = "https://github.com/RustPython/RustPython.git", rev = "24800cbfcf71147392fd8579d21132780e5a9a7a", features = ["freeze-stdlib"] }
1010
serde = "1"
1111
serde_derive = "1"
1212
serde_json = "1"

script/src/error.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ pub enum Error {
1717

1818
impl Error {
1919
pub fn from_py(vm: &VirtualMachine, e: PyBaseExceptionRef) -> Self {
20-
let mut buf = Vec::new();
21-
let _ = write_exception(&mut buf, vm, &e);
22-
let s = String::from_utf8_lossy(&buf).into_owned();
20+
let mut s = String::new();
21+
let _ = write_exception(&mut s, vm, &e);
2322
Error::Python(s)
2423
}
2524
}

script/src/gamedata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use std::cell::RefCell;
88
use std::convert::TryInto;
99
use std::sync::RwLock;
1010
use vm::builtins::PyInt;
11-
use vm::pyobject::{BorrowValue, IntoPyObject, PyObjectRef, PyResult};
1211
use vm::VirtualMachine;
12+
use vm::{IntoPyObject, PyObjectRef, PyResult};
1313

1414
thread_local!(
1515
static GAME_DATA: UnsyncLazy<RefCell<Option<GameData>>> =
@@ -60,7 +60,7 @@ pub fn value_to_py(vm: &VirtualMachine, value: Value) -> PyObjectRef {
6060

6161
pub fn py_to_value(vm: &VirtualMachine, pyvalue: PyObjectRef) -> PyResult<Value> {
6262
let value = if let Some(i) = pyvalue.payload::<PyInt>() {
63-
let i: i64 = i.borrow_value().try_into().unwrap();
63+
let i: i64 = i.as_bigint().try_into().unwrap();
6464
Value::Int(i)
6565
} else {
6666
return Err(vm.new_type_error(format!("invalid type value \"{}\" for set_gvar", pyvalue)));

script/src/rr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ mod _rr {
1010
use rustpython_vm as vm;
1111
use std::convert::TryInto;
1212
use vm::builtins::{PyNone, PyStrRef};
13-
use vm::pyobject::{PyObjectRef, PyResult, PyValue};
14-
use vm::VirtualMachine;
13+
use vm::{PyObjectRef, PyResult, PyValue, VirtualMachine};
1514

1615
#[pyfunction]
1716
fn yield_result(vm: &VirtualMachine) -> Option<PyObjectRef> {

0 commit comments

Comments
 (0)