◐ Shell
clean mode source ↗

Message 219601 - Python tracker

As for what's actually wrong here, Hirokazu Yamamoto's diagnosis in msg123615 (adjusted for 2.7) is correct.

Either of the last two patches I posted should work to fix this issue, but they're both just band-aids rather than a real, once-and-for-all fix.  #20035 (which I need to rewrite again) will be a once-and-for-all fix for 3.5 by getting rid of tkinter._fix, but I'm not sure if such an invasive fix is appropriate for 2.7 and 3.4.  I prefer the second band-aid (import FixTk at the top of test_support) just because it's simpler and also prevents the 'os.environ has been changed' warnings.

A workaround that doesn't require a patch is to just set TCL_LIBRARY manually in your environment before running the tests, which is how the 3.x buildbots are currently working (see Tools/buildbot/test.bat:4).

For the record, I'm not sure why the 3.x fix we came up with earlier in this issue worked, though I suspect it has something to do with _fix being part of the tkinter package.  The same patch fails on 2.7 because Tkinter is not a package; FixTk is a standalone module and is thus completely unaffected by support.import_fresh_module('Tkinter').  Fresh-importing FixTk itself works, since it's what we actually need to run.