@@ -55,8 +55,6 @@ pub(crate) mod _thread {
5555 // this is a value in seconds
5656 #[ pyattr]
5757 const TIMEOUT_MAX : f64 = ( TIMEOUT_MAX_IN_MICROSECONDS / 1_000_000 ) as f64 ;
58- const DEFAULT_THREAD_STACK_SIZE : usize = 8 * 1024 * 1024 ;
59-
6058 #[ pyattr]
6159 fn error ( vm : & VirtualMachine ) -> PyTypeRef {
6260 vm. ctx . exceptions . runtime_error . to_owned ( )
@@ -595,12 +593,11 @@ pub(crate) mod _thread {
595593 vm : & VirtualMachine ,
596594 ) -> thread:: Builder {
597595 let configured = vm. state . stacksize . load ( ) ;
598- let stack_size = if configured != 0 {
599- configured
596+ if configured != 0 {
597+ thread_builder . stack_size ( configured)
600598 } else {
601- VirtualMachine :: current_c_stack_size ( ) . max ( DEFAULT_THREAD_STACK_SIZE )
602- } ;
603- thread_builder. stack_size ( stack_size)
599+ thread_builder
600+ }
604601 }
605602
606603 /// Clean up thread-local data for the current thread.
@@ -903,7 +900,7 @@ pub(crate) mod _thread {
903900 // Guard that removes thread-local data when dropped
904901 struct LocalGuard {
905902 local : Weak < LocalData > ,
906- thread_id : std :: thread :: ThreadId ,
903+ thread_id : u64 ,
907904 }
908905
909906 impl Drop for LocalGuard {
@@ -919,7 +916,7 @@ pub(crate) mod _thread {
919916
920917 // Shared data structure for Local
921918 struct LocalData {
922- data : parking_lot:: Mutex < std:: collections:: HashMap < std :: thread :: ThreadId , PyDictRef > > ,
919+ data : parking_lot:: Mutex < std:: collections:: HashMap < u64 , PyDictRef > > ,
923920 }
924921
925922 impl fmt:: Debug for LocalData {
@@ -938,7 +935,7 @@ pub(crate) mod _thread {
938935 #[ pyclass( with( GetAttr , SetAttr ) , flags( BASETYPE ) ) ]
939936 impl Local {
940937 fn l_dict ( & self , vm : & VirtualMachine ) -> PyDictRef {
941- let thread_id = std :: thread :: current ( ) . id ( ) ;
938+ let thread_id = current_thread_id ( ) ;
942939
943940 // Fast path: check if dict exists under lock
944941 if let Some ( dict) = self . inner . data . lock ( ) . get ( & thread_id) . cloned ( ) {
@@ -974,6 +971,11 @@ pub(crate) mod _thread {
974971 dict
975972 }
976973
974+ #[ pygetset( name = "__dict__" ) ]
975+ fn dict ( zelf : PyRef < Self > , vm : & VirtualMachine ) -> PyDictRef {
976+ zelf. l_dict ( vm)
977+ }
978+
977979 #[ pyslot]
978980 fn slot_new ( cls : PyTypeRef , _args : FuncArgs , vm : & VirtualMachine ) -> PyResult {
979981 Self {
0 commit comments