| 702 | |
| 703 | #[pygetset] |
| 704 | fn _asyncio_awaited_by(&self, vm: &VirtualMachine) -> PyResult<PyObjectRef> { |
| 705 | let awaited_by = self.fut_awaited_by.read().clone(); |
| 706 | match awaited_by { |
| 707 | None => Ok(vm.ctx.none()), |
| 708 | Some(obj) => { |
| 709 | if self.fut_awaited_by_is_set.load(Ordering::Relaxed) { |
| 710 | // Already a Set |
| 711 | Ok(obj) |
| 712 | } else { |
| 713 | // Single object - create a Set for the return value |
| 714 | let new_set = PySet::default().into_ref(&vm.ctx); |
| 715 | new_set.add(obj, vm)?; |
| 716 | Ok(new_set.into()) |
| 717 | } |
| 718 | } |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | /// Add waiter to fut_awaited_by with single-object optimization |
| 723 | fn awaited_by_add(&self, waiter: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { |