|
1 | 1 | use crate::builtins::PyBytes;
|
2 | 2 | use crate::types::Callable;
|
3 | 3 | use crate::{Py, PyObjectRef, PyPayload};
|
4 |
| -use crate::{PyResult, VirtualMachine, builtins::PyTypeRef, types::Constructor}; |
| 4 | +use crate::{ |
| 5 | + PyResult, VirtualMachine, |
| 6 | + builtins::{PyType, PyTypeRef}, |
| 7 | + types::Constructor, |
| 8 | +}; |
5 | 9 | use crossbeam_utils::atomic::AtomicCell;
|
6 | 10 | use rustpython_common::lock::PyRwLock;
|
7 |
| -use rustpython_vm::stdlib::ctypes::base::PyCSimple; |
| 11 | +use rustpython_vm::stdlib::ctypes::base::PyCData; |
8 | 12 |
|
9 |
| -// TODO: make it metaclass |
10 |
| -#[pyclass(name = "ArrayType", module = "_ctypes")] |
| 13 | +#[pyclass(name = "PyCArrayType", base = "PyType", module = "_ctypes")] |
11 | 14 | #[derive(PyPayload)]
|
12 | 15 | pub struct PyCArrayType {
|
13 | 16 | pub(super) inner: PyCArray,
|
@@ -44,7 +47,12 @@ impl Constructor for PyCArrayType {
|
44 | 47 | #[pyclass(flags(IMMUTABLETYPE), with(Callable, Constructor))]
|
45 | 48 | impl PyCArrayType {}
|
46 | 49 |
|
47 |
| -#[pyclass(name = "Array", base = "PyCSimple", module = "_ctypes")] |
| 50 | +#[pyclass( |
| 51 | + name = "Array", |
| 52 | + base = "PyCData", |
| 53 | + metaclass = "PyCArrayType", |
| 54 | + module = "_ctypes" |
| 55 | +)] |
48 | 56 | #[derive(PyPayload)]
|
49 | 57 | pub struct PyCArray {
|
50 | 58 | pub(super) typ: PyRwLock<PyTypeRef>,
|
|
0 commit comments