Skip to content

Commit 9331963

Browse files
Add PyObject_HasAttrWithError
1 parent 0597510 commit 9331963

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

crates/capi/src/object.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,18 @@ pub unsafe extern "C" fn PyObject_SetAttr(
202202
})
203203
}
204204

205+
#[unsafe(no_mangle)]
206+
pub unsafe extern "C" fn PyObject_HasAttrWithError(
207+
obj: *mut PyObject,
208+
attr_name: *mut PyObject,
209+
) -> c_int {
210+
with_vm(|vm| {
211+
let obj = unsafe { &*obj };
212+
let name = unsafe { &*attr_name }.try_downcast_ref::<PyStr>(vm)?;
213+
obj.has_attr(name, vm)
214+
})
215+
}
216+
205217
#[unsafe(no_mangle)]
206218
pub unsafe extern "C" fn PyObject_GenericGetAttr(
207219
obj: *mut PyObject,

0 commit comments

Comments
 (0)