Add `list.__class_getitem__` method
See also
@@ -5,6 +5,7 @@ use std::ops::DerefMut;
use crossbeam_utils::atomic::AtomicCell;
+use super::genericalias::{PyGenericAlias, PyGenericAliasRef};
use super::int;
use super::iter::{
IterStatus,
@@ -411,6 +412,11 @@ impl PyList {
std::mem::swap(self.borrow_vec_mut().deref_mut(), &mut elements);
Ok(())
}
+
+ #[pyclassmethod(magic)]
+ fn class_getitem(cls: PyTypeRef, args: PyObjectRef, vm: &VirtualMachine) -> PyGenericAliasRef {
+ PyGenericAlias::new(cls, args, vm).into_ref(vm)
+ }
}
impl Iterable for PyList {
