File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,23 @@ def test_embedded_null(self):
508508 widget .selection_range (0 , 'end' )
509509 self .assertEqual (widget .selection_get (), '\u20ac \0 abc\x00 def' )
510510
511+ def test_settrace_gc (self ):
512+ # Regression test for https://github.com/python/cpython/issues/138791.
513+ root = tkinter .Tk ()
514+ trace = lambda * _ , ** __ : None
515+ trace .evil = type (root .tk )
516+ root .tk .settrace (trace )
517+ root .destroy ()
518+
519+ def test_createtimerhandler_gc (self ):
520+ # Regression test for https://github.com/python/cpython/issues/138791.
521+ root = tkinter .Tk ()
522+ func = lambda * _ , ** __ : None
523+ func .evil = type (root .tk .createtimerhandler (0 , print ))
524+ # Large timeout (in ms) so that the object is destroyed before.
525+ root .tk .createtimerhandler (1234567 , func )
526+ root .destroy ()
527+
511528
512529class WmTest (AbstractTkTest , unittest .TestCase ):
513530
You can’t perform that action at this time.
0 commit comments