Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Lib/test/test_tcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ def test_returning_deeply_nested(self):
interp.eval('set x a; for {set i 0} {$i < %d} {incr i} {set x [list $x]}'
% support.exceeds_recursion_limit())
self.assertRaises(RecursionError, interp.getvar, 'x')
interp = None

# gh-161353: Clean up explicitly per-thread state to avoid leaking an
# event handle on Windows when test_tcl is run with -R 3:3 option.
_tkinter._finalize_thread()

def test_user_command(self):
result = None
Expand Down
15 changes: 15 additions & 0 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3584,6 +3584,20 @@ _tkinter_getbusywaitinterval_impl(PyObject *module)
return Tkinter_busywaitinterval;
}

/*[clinic input]
_tkinter._finalize_thread
Clean up per-thread state.
[clinic start generated code]*/

static PyObject *
_tkinter__finalize_thread_impl(PyObject *module)
/*[clinic end generated code: output=4ed0d3be4d1f8de8 input=ea68096ee9b83d23]*/
{
Tcl_FinalizeThread();
Py_RETURN_NONE;
}

#include "clinic/_tkinter.c.h"

static PyMethodDef Tktt_methods[] =
Expand Down Expand Up @@ -3681,6 +3695,7 @@ static PyMethodDef moduleMethods[] =
_TKINTER_CREATE_METHODDEF
_TKINTER_SETBUSYWAITINTERVAL_METHODDEF
_TKINTER_GETBUSYWAITINTERVAL_METHODDEF
_TKINTER__FINALIZE_THREAD_METHODDEF
{NULL, NULL}
};

Expand Down
20 changes: 19 additions & 1 deletion Modules/clinic/_tkinter.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading