Skip to content

Commit 75f877b

Browse files
committed
Fix build on master
1 parent 4725a80 commit 75f877b

6 files changed

Lines changed: 23 additions & 23 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vm/src/stdlib/ctypes/array.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ use crate::common::borrow::BorrowedValueMut;
1111
use crate::common::lock::{PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard};
1212
use crate::function::OptionalArg;
1313
use crate::pyobject::{
14-
BorrowValue, Either, IdProtocol, PyObjectRef, PyRef, PyResult, PyValue, StaticType,
15-
TryFromObject, TypeProtocol,
14+
IdProtocol, PyObjectRef, PyRef, PyResult, PyValue, StaticType, TryFromObject, TypeProtocol,
1615
};
1716
use crate::slots::BufferProtocol;
17+
use crate::utils::Either;
1818
use crate::VirtualMachine;
1919

2020
use crate::stdlib::ctypes::basics::{
@@ -287,7 +287,7 @@ impl PyCArray {
287287
let length = match vm.get_attribute(cls.as_object().to_owned(), "_length_") {
288288
Ok(ref length_obj) => {
289289
if let Ok(length_int) = length_obj.clone().downcast_exact::<PyInt>(vm) {
290-
if length_int.borrow_value().sign() == Sign::Minus {
290+
if length_int.as_bigint().sign() == Sign::Minus {
291291
Err(vm.new_value_error(
292292
"The '_length_' attribute must not be negative".to_string(),
293293
))

vm/src/stdlib/ctypes/basics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ use crate::common::borrow::{BorrowedValue, BorrowedValueMut};
1010
use crate::common::lock::{PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard};
1111
use crate::function::OptionalArg;
1212
use crate::pyobject::{
13-
Either, PyObjectRef, PyRef, PyResult, PyValue, StaticType, TryFromObject, TypeProtocol,
13+
PyObjectRef, PyRef, PyResult, PyValue, StaticType, TryFromObject, TypeProtocol,
1414
};
1515
use crate::slots::BufferProtocol;
16+
use crate::utils::Either;
1617
use crate::VirtualMachine;
1718

1819
use crate::stdlib::ctypes::array::make_array_with_lenght;

vm/src/stdlib/ctypes/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::pyobject::{PyClassImpl, PyObjectRef, PyValue};
1+
use crate::pyobject::{PyClassImpl, PyObjectRef};
22
use crate::VirtualMachine;
33

44
mod array;
@@ -25,17 +25,17 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
2525
py_module!(vm, "_ctypes", {
2626
"__version__" => ctx.new_str("1.1.0"),
2727

28-
"dlopen" => ctx.new_function(dlopen),
29-
"dlsym" => ctx.new_function(dlsym),
30-
"dlclose" => ctx.new_function(dlclose),
28+
"dlopen" => ctx.new_function("dlopen", dlopen),
29+
"dlsym" => ctx.new_function("dlsym", dlsym),
30+
"dlclose" => ctx.new_function("dlclose", dlclose),
3131

32-
"alignment" => ctx.new_function(alignment),
33-
"sizeof" => ctx.new_function(sizeof_func),
34-
"byref" => ctx.new_function(byref),
35-
"addressof" => ctx.new_function(addressof),
32+
"alignment" => ctx.new_function("alignment", alignment),
33+
"sizeof" => ctx.new_function("sizeof", sizeof_func),
34+
"byref" => ctx.new_function("byref", byref),
35+
"addressof" => ctx.new_function("addressof", addressof),
3636

37-
"POINTER" => ctx.new_function(POINTER),
38-
"pointer" => ctx.new_function(pointer_fn),
37+
"POINTER" => ctx.new_function("POINTER", POINTER),
38+
"pointer" => ctx.new_function("pointer", pointer_fn),
3939
"_pointer_type_cache" => ctx.new_dict(),
4040

4141
"CFuncPtr" => PyCFuncPtr::make_class(ctx),

vm/src/stdlib/ctypes/pointer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::fmt;
22

3-
use crate::builtins::{PyDict, PyTypeRef};
3+
use crate::builtins::PyTypeRef;
44
use crate::pyobject::{PyObjectRef, PyValue, StaticType};
55
use crate::VirtualMachine;
66

7-
use crate::stdlib::ctypes::basics::{PyCData, PyCDataMethods};
7+
use crate::stdlib::ctypes::basics::PyCData;
88

99
#[pyclass(module = "_ctypes", name = "_Pointer", base = "PyCData")]
1010
pub struct PyCPointer {}

vm/src/stdlib/ctypes/primitive.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crossbeam_utils::atomic::AtomicCell;
2-
use rustpython_common::borrow::BorrowValue;
32
use std::fmt;
43

54
use crate::builtins::memory::try_buffer_from_object;
@@ -9,17 +8,16 @@ use crate::builtins::{
98
};
109
use crate::function::OptionalArg;
1110
use crate::pyobject::{
12-
Either, IdProtocol, PyObjectRef, PyRef, PyResult, PyValue, StaticType, TryFromObject,
13-
TypeProtocol,
11+
IdProtocol, PyObjectRef, PyRef, PyResult, PyValue, StaticType, TryFromObject, TypeProtocol,
1412
};
15-
use crate::VirtualMachine;
16-
1713
use crate::stdlib::ctypes::array::PyCArray;
1814
use crate::stdlib::ctypes::basics::{
1915
get_size, BorrowValueMut, PyCData, PyCDataFunctions, PyCDataMethods, PyCDataSequenceMethods,
2016
};
2117
use crate::stdlib::ctypes::function::PyCFuncPtr;
2218
use crate::stdlib::ctypes::pointer::PyCPointer;
19+
use crate::utils::Either;
20+
use crate::VirtualMachine;
2321

2422
const SIMPLE_TYPE_CHARS: &str = "cbBhHiIlLdfguzZPqQ?";
2523

@@ -33,12 +31,12 @@ fn set_primitive(_type_: &str, value: &PyObjectRef, vm: &VirtualMachine) -> PyRe
3331
|| value
3432
.clone()
3533
.downcast_exact::<PyByteArray>(vm)
36-
.map_or(false, |v| v.borrow_value().len() == 1)
34+
.map_or(false, |v| v.borrow_buf().len() == 1)
3735
|| value
3836
.clone()
3937
.downcast_exact::<PyInt>(vm)
4038
.map_or(Ok(false), |v| {
41-
let n: i64 = try_to_primitive(v.borrow_value(), vm)?;
39+
let n: i64 = try_to_primitive(v.as_bigint(), vm)?;
4240
Ok(0 <= n && n <= 255)
4341
})?
4442
{

0 commit comments

Comments
 (0)