File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2847,5 +2847,25 @@ def run_last():
28472847 err .decode ())
28482848
28492849
2850+ class ThreadHandleRegressionTest (unittest .TestCase ):
2851+ def test_subclass_can_define_handle (self ):
2852+ # gh-132578: Ensure third-party libraries overriding or defining
2853+ # a custom `_handle` attribute/method don't clash with CPython internal implementation details.
2854+ class CustomThread (threading .Thread ):
2855+ def __init__ (self ):
2856+ super ().__init__ ()
2857+ self ._handle = "custom_third_party_handle_value"
2858+
2859+ def run (self ):
2860+ pass
2861+
2862+ t = CustomThread ()
2863+ t .start ()
2864+ t .join ()
2865+
2866+ # Assert that our custom handle parameter was preserved and did not break the thread run lifecycle
2867+ self .assertEqual (t ._handle , "custom_third_party_handle_value" )
2868+
2869+
28502870if __name__ == "__main__" :
28512871 unittest .main ()
You can’t perform that action at this time.
0 commit comments