Skip to content

Commit 4eac9ce

Browse files
author
Andrew J Westlake
committed
Cleaned up some dead code in generic.rs
1 parent 5bab559 commit 4eac9ce

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/generic.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::future::Future;
22

3-
use futures::channel::oneshot;
43
use pyo3::{exceptions::PyException, prelude::*};
54

65
use crate::{dump_err, get_event_loop, CALL_SOON, CREATE_FUTURE, EXPECT_INIT};
@@ -105,37 +104,6 @@ where
105104
Ok(())
106105
}
107106

108-
#[pyclass]
109-
struct PyTaskCompleter {
110-
tx: Option<oneshot::Sender<PyResult<PyObject>>>,
111-
}
112-
113-
#[pymethods]
114-
impl PyTaskCompleter {
115-
#[call]
116-
#[args(task)]
117-
pub fn __call__(&mut self, task: &PyAny) -> PyResult<()> {
118-
debug_assert!(task.call_method0("done")?.extract()?);
119-
120-
let result = match task.call_method0("result") {
121-
Ok(val) => Ok(val.into()),
122-
Err(e) => Err(e),
123-
};
124-
125-
// unclear to me whether or not this should be a panic or silent error.
126-
//
127-
// calling PyTaskCompleter twice should not be possible, but I don't think it really hurts
128-
// anything if it happens.
129-
if let Some(tx) = self.tx.take() {
130-
if tx.send(result).is_err() {
131-
// cancellation is not an error
132-
}
133-
}
134-
135-
Ok(())
136-
}
137-
}
138-
139107
fn set_result(py: Python, future: &PyAny, result: PyResult<PyObject>) -> PyResult<()> {
140108
match result {
141109
Ok(val) => {

0 commit comments

Comments
 (0)