File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1185,7 +1185,7 @@ pub(crate) mod _thread {
11851185 done_event : Arc < ( parking_lot:: Mutex < bool > , parking_lot:: Condvar ) > ,
11861186 }
11871187
1188- #[ pyclass]
1188+ #[ pyclass( with ( Representable ) ) ]
11891189 impl ThreadHandle {
11901190 fn new ( vm : & VirtualMachine ) -> Self {
11911191 let inner = Arc :: new ( parking_lot:: Mutex :: new ( ThreadHandleInner {
@@ -1427,6 +1427,16 @@ pub(crate) mod _thread {
14271427 }
14281428 }
14291429
1430+ impl Representable for ThreadHandle {
1431+ fn repr_str ( zelf : & Py < Self > , _vm : & VirtualMachine ) -> PyResult < String > {
1432+ let ident = zelf. inner . lock ( ) . ident ;
1433+ Ok ( format ! (
1434+ "<{} object: ident={ident}>" ,
1435+ zelf. class( ) . slot_name( )
1436+ ) )
1437+ }
1438+ }
1439+
14301440 #[ pyfunction]
14311441 fn start_joinable_thread (
14321442 mut f_args : FuncArgs ,
You can’t perform that action at this time.
0 commit comments