@@ -13,7 +13,7 @@ fn text_markdown<'py>(html: &Bound<'py, PyString>, width: usize) -> PyResult<Str
1313 let html_string = html. clone ( ) . unbind ( ) ;
1414 let html_cow = html_string. to_cow ( py) ?;
1515 let text = py
16- . allow_threads ( || from_read ( html_cow. as_bytes ( ) , width) )
16+ . detach ( || from_read ( html_cow. as_bytes ( ) , width) )
1717 . expect ( "Error when extracting markdown text" ) ;
1818 Ok ( text)
1919}
@@ -27,9 +27,7 @@ fn text_plain<'py>(html: &Bound<'py, PyString>, width: usize) -> PyResult<String
2727 let html_string = html. clone ( ) . unbind ( ) ;
2828 let html_cow = html_string. to_cow ( py) ?;
2929 let text = py
30- . allow_threads ( || {
31- from_read_with_decorator ( html_cow. as_bytes ( ) , width, TrivialDecorator :: new ( ) )
32- } )
30+ . detach ( || from_read_with_decorator ( html_cow. as_bytes ( ) , width, TrivialDecorator :: new ( ) ) )
3331 . expect ( "Error when extracting plain text" ) ;
3432 Ok ( text)
3533}
@@ -43,9 +41,7 @@ fn text_rich<'py>(html: &Bound<'py, PyString>, width: usize) -> PyResult<String>
4341 let html_string = html. clone ( ) . unbind ( ) ;
4442 let html_cow = html_string. to_cow ( py) ?;
4543 let text = py
46- . allow_threads ( || {
47- from_read_with_decorator ( html_cow. as_bytes ( ) , width, RichDecorator :: new ( ) )
48- } )
44+ . detach ( || from_read_with_decorator ( html_cow. as_bytes ( ) , width, RichDecorator :: new ( ) ) )
4945 . expect ( "Error when extracting rich text" ) ;
5046 Ok ( text)
5147}
0 commit comments