We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b2abb1a commit 12074deCopy full SHA for 12074de
vm/src/stdlib/ctypes.rs
@@ -214,6 +214,16 @@ pub(crate) mod _ctypes {
214
}
215
216
217
+ #[pyfunction]
218
+ fn addressof(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> {
219
+ if obj.is_instance(PyCSimple::static_type().as_ref(), vm)? {
220
+ let simple = obj.downcast_ref::<PyCSimple>().unwrap();
221
+ Ok(simple.value.load().as_ptr() as usize)
222
+ } else {
223
+ Err(vm.new_type_error("expected a ctypes instance".to_string()))
224
+ }
225
226
+
227
#[pyfunction]
228
fn get_errno() -> i32 {
229
errno::errno().0
0 commit comments