pyo3/types/
code.rs
1use crate::ffi;
2use crate::PyAny;
3
4#[repr(transparent)]
9pub struct PyCode(PyAny);
10
11pyobject_native_type_core!(
12 PyCode,
13 pyobject_native_static_type_object!(ffi::PyCode_Type),
14 #checkfunction=ffi::PyCode_Check
15);
16
17#[cfg(test)]
18mod tests {
19 use super::*;
20 use crate::types::PyTypeMethods;
21 use crate::{PyTypeInfo, Python};
22
23 #[test]
24 fn test_type_object() {
25 Python::with_gil(|py| {
26 assert_eq!(PyCode::type_object(py).name().unwrap(), "code");
27 })
28 }
29}