Skip to content

Commit e6a478a

Browse files
committed
check exports in __setstate__
1 parent 985fdc6 commit e6a478a

File tree

1 file changed

+5
-5
lines changed
  • crates/vm/src/stdlib

1 file changed

+5
-5
lines changed

crates/vm/src/stdlib/io.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4324,13 +4324,13 @@ mod _io {
43244324
let pos: u64 = state[1].clone().try_into_value(vm)?;
43254325
let dict = &state[2];
43264326

4327-
// Set content
4328-
*zelf.buffer.write() = BufferedIO::new(Cursor::new(content.as_bytes().to_vec()));
4329-
4330-
// Set position
4331-
zelf.buffer(vm)?
4327+
// Check exports and set content (like CHECK_EXPORTS)
4328+
let mut buffer = zelf.try_resizable(vm)?;
4329+
*buffer = BufferedIO::new(Cursor::new(content.as_bytes().to_vec()));
4330+
buffer
43324331
.seek(SeekFrom::Start(pos))
43334332
.map_err(|err| os_err(vm, err))?;
4333+
drop(buffer);
43344334

43354335
// Set __dict__ if provided
43364336
if !vm.is_none(dict) {

0 commit comments

Comments
 (0)