MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / alloc

Method alloc

src/py_class/mod.rs:140–144  ·  view source on GitHub ↗
(py: Python, ty: &PyType, _init_val: ())

Source from the content-addressed store, hash-verified

138 type InitType = ();
139
140 unsafe fn alloc(py: Python, ty: &PyType, _init_val: ()) -> PyResult<PyObject> {
141 let ptr = ffi::PyType_GenericAlloc(ty.as_type_ptr(), 0);
142 //println!("BaseObject::alloc({:?}) = {:?}", ty.as_type_ptr(), ptr);
143 err::result_from_owned_ptr(py, ptr)
144 }
145
146 unsafe fn dealloc(_py: Python, obj: *mut ffi::PyObject) {
147 //println!("BaseObject::dealloc({:?})", ptr);

Callers

nothing calls this directly

Calls 2

result_from_owned_ptrFunction · 0.85
as_type_ptrMethod · 0.80

Tested by

no test coverage detected