We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e740de6 + b0dabd6 commit 4f2d70fCopy full SHA for 4f2d70f
vm/src/builtins/pytype.rs
@@ -381,6 +381,15 @@ impl PyType {
381
fn mro(zelf: PyRef<Self>) -> Vec<PyObjectRef> {
382
zelf.iter_mro().map(|cls| cls.clone().into()).collect()
383
}
384
+
385
+ #[pymethod(name = "__ror__")]
386
+ #[pymethod(magic)]
387
+ pub fn or(zelf: PyRef<Self>, other: PyObjectRef, vm: &VirtualMachine) -> PyResult {
388
+ let union = vm.import("typing", None, 0)?.get_attr("Union", vm)?;
389
+ let getitem = vm.get_method(union, "__getitem__").unwrap();
390
+ vm.invoke(&getitem?, ((zelf, other),))
391
+ }
392
393
#[pyslot]
394
fn slot_new(metatype: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
395
vm_trace!("type.__new__ {:?}", args);
0 commit comments