Skip to content

Commit ea097d7

Browse files
committed
fix comment
1 parent 5de068e commit ea097d7

3 files changed

Lines changed: 0 additions & 10 deletions

File tree

src/executors/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,11 @@ where
6666
for<'py> <T as IntoPyObject<'py>>::Error: std::fmt::Debug,
6767
{
6868
if function.is_async {
69-
// Single GIL acquisition for async functions
7069
let output: Py<PyAny> = Python::with_gil(|py| {
7170
pyo3_async_runtimes::tokio::into_future(get_function_output(function, py, input)?)
7271
})?
7372
.await?;
7473

75-
// Reuse the same GIL acquisition for extraction
7674
Python::with_gil(|py| -> Result<MiddlewareReturn> {
7775
// Try response extraction first, then request
7876
match output.extract::<Response>(py) {
@@ -84,12 +82,10 @@ where
8482
}
8583
})
8684
} else {
87-
// Single GIL acquisition for sync functions - do everything in one block
8885
Python::with_gil(|py| -> Result<MiddlewareReturn> {
8986
let output = get_function_output(function, py, input)?;
9087
debug!("Middleware output: {:?}", output);
9188

92-
// Extract within the same GIL acquisition
9389
match output.extract::<Response>() {
9490
Ok(response) => Ok(MiddlewareReturn::Response(response)),
9591
Err(_) => match output.extract::<Request>() {
@@ -107,17 +103,14 @@ pub async fn execute_http_function(
107103
function: &FunctionInfo,
108104
) -> PyResult<Response> {
109105
if function.is_async {
110-
// Single GIL acquisition for async setup
111106
let output = Python::with_gil(|py| {
112107
let function_output = get_function_output(function, py, request)?;
113108
pyo3_async_runtimes::tokio::into_future(function_output)
114109
})?
115110
.await?;
116111

117-
// Single GIL acquisition for extraction
118112
Python::with_gil(|py| -> PyResult<Response> { output.extract(py) })
119113
} else {
120-
// Single GIL acquisition for entire sync execution
121114
Python::with_gil(|py| -> PyResult<Response> {
122115
get_function_output(function, py, request)?.extract()
123116
})

src/types/request.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ impl<'py> IntoPyObject<'py> for Request {
4747
}
4848
};
4949

50-
// Optimize form_data conversion - pre-allocate dict size
5150
let form_data: Py<PyDict> = match self.form_data {
5251
Some(data) if !data.is_empty() => {
5352
let dict = PyDict::new(py);
@@ -60,7 +59,6 @@ impl<'py> IntoPyObject<'py> for Request {
6059
_ => PyDict::new(py).into(),
6160
};
6261

63-
// Optimize files conversion - avoid unnecessary bytes allocation
6462
let files: Py<PyDict> = match self.files {
6563
Some(data) if !data.is_empty() => {
6664
let dict = PyDict::new(py);

src/types/response.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ impl<'py> IntoPyObject<'py> for Response {
6767
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
6868
let headers = self.headers.into_pyobject(py)?.extract()?;
6969

70-
// Optimize description conversion - avoid to_vec() clone
7170
let description = if self.description.is_empty() {
7271
"".into_pyobject(py)?.into_any()
7372
} else {

0 commit comments

Comments
 (0)