
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2016-07-25 02:07 bymartin.panter, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| tix_default_root.patch | serhiy.storchaka,2016-07-25 03:02 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 552 | closed | dstufft,2017-03-31 16:36 | |
| Messages (14) | |||
|---|---|---|---|
| msg271206 -(view) | Author: Martin Panter (martin.panter)*![]() | Date: 2016-07-25 02:07 | |
$ ./python -m unittest -v test.test_{idle,tix}. . .test_tix (unittest.loader._FailedTest) ... ERROR======================================================================ERROR: test_tix (unittest.loader._FailedTest)----------------------------------------------------------------------ImportError: Failed to import test module: test_tixTraceback (most recent call last): File "/media/disk/home/proj/python/cpython/Lib/unittest/loader.py", line 153, in loadTestsFromName module = __import__(module_name) File "/media/disk/home/proj/python/cpython/Lib/test/test_tix.py", line 11, in <module> from tkinter import tix, TclError File "/media/disk/home/proj/python/cpython/Lib/tkinter/tix.py", line 30, in <module> from tkinter import _cnfmerge, _default_rootImportError: cannot import name '_default_root'Without test_idle, test_tix is skipped for me:$ ./python -m unittest -v test.test_tixtest_tix_available (test.test_tix.TestTix) ... skipped 'Tix not available'Reverting to before revision064b29dde096 (Issue 24137) also fixes the failure. | |||
| msg271219 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-07-25 03:02 | |
There is a bug in tix. _default_root shouldn't be imported, since this is modifiable attribute. | |||
| msg271220 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-07-25 03:10 | |
I could reverse the effect of test_idle calling tk.NoDefaultRoot by adding tk._support_default_root = 1 tk._default_root = Noneat the very end, but I take Serhiy's comment as suggesting that there should be no need. | |||
| msg271221 -(view) | Author: Zachary Ware (zach.ware)*![]() | Date: 2016-07-25 03:34 | |
I think there are two bugs to be fixed here:1) as Serhiy said, if tix needs _default_root, it should use it as tkinter._default_root instead of importing it directly2) test_idle should not permanently modify the tkinter namespace | |||
| msg271225 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-07-25 04:32 | |
New changeset5c76f787e695 by Terry Jan Reedy in branch 'default':Issue#24137, issue#27611: Restore tkinter after test_idle.https://hg.python.org/cpython/rev/5c76f787e695 | |||
| msg271226 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-07-25 04:37 | |
#24137 only patched default, so either too many versions were selected or there is another bug in test_tix. Martin and Serhiy can sort that out.The restore patch I pushed is based on this from tkinter.__init__-----_support_default_root = 1_default_root = Nonedef NoDefaultRoot(): """Inhibit setting of default root window. Call this function to inhibit that the first instance of Tk is used for windows without an explicit parent window. """ global _support_default_root _support_default_root = 0 global _default_root _default_root = None del _default_root | |||
| msg272822 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-08-16 04:10 | |
New changeseta6a248479b66 by Terry Jan Reedy in branch 'default':Issue#27611,#24137: Only change tkinter when easily restored.https://hg.python.org/cpython/rev/a6a248479b66 | |||
| msg272823 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-08-16 04:11 | |
Ned Deily noticed the same problem when running with test.regrtest#27714.I cannot reproduce this issue when running both tests either with unittest or test.regrtest.F:\Python\dev>36\pcbuild\win32\python_d.exe -m unittest test.test_tix test.test_idle test.test_tix.............................................................................................................................................................................................................................----------------------------------------------------------------------Ran 221 tests in 3.959sOKF:\Python\dev>36\pcbuild\win32\python_d.exe -m test -ugui test_tix test_idle test_tixRun tests sequentially0:00:00 [1/3] test_tix0:00:00 [2/3] test_idle0:00:03 [3/3] test_tixAll 3 tests OK. if __name__ == '__main__': unittest.main(verbosity=2, exit=False)+ tk._support_default_root = 1+ tk._default_root = NoneZach, I don't know of any way to get either unittest or test.regrtest to run anything in test_idle after it runs the test collector *and* the tests. Do you?The addition of tk.NoDefaultRoot() to both IDLE and its tests was suggested by Serhiy in#24137. Doing so exposed several issues in htests but no real bugs in IDLE itself. My patch to restore tkinter module only works when test_idle is run as main. So as far as that patch goes, tkinter should only changed when the test is run as main. I will move the call. I have already changed my check script to run test_idle this way.Otherwise, the easiest way to leave tkinter as it was when testing ends is to not change it. I am aware that tkinter tests avoid the by defining a mixin class with class methods that call and undo the call. It is used in 11 test classes within the tkinter and ttk tests. However, this refactoring would be harder to apply to IDLE tests and not sufficient in itself. It is at best a future project.I added a guard to IDLE's NoDefaultRoot call for when pyshell.main is broken into multiple testable functions. | |||
| msg272839 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-08-16 05:44 | |
New changesetcddd633b959f by Terry Jan Reedy in branch '2.7':Issue#27611: Don't import volatile attribute.https://hg.python.org/cpython/rev/cddd633b959fNew changeseta42933335897 by Terry Jan Reedy in branch '3.5':Issue#27611: Don't import volatile attribute.https://hg.python.org/cpython/rev/a42933335897 | |||
| msg272844 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-08-16 07:09 | |
Terry, you committed not full patch. The tix module still doesn't work after NoDefaultRoot(). | |||
| msg272846 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-08-16 07:19 | |
What do you mean by 'does not work' and what did I omit? | |||
| msg272860 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-08-16 14:25 | |
DisplayStyle() fails with AttributeError after NoDefaultRoot(). Should be made following changes:1. The refwindow option should have priority over _default_root.2. Add the master keyword-only parameter for creating styles without refwindow (3.6 only). | |||
| msg272862 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-08-16 15:55 | |
This issue is about test_tix failing when run after test_idle, due to the conjunction of two specific causes, one old (tix importing _default_root), one new (IDLE deleting and not restoring _default_root). The new cause exposed the old. Fixing either cause would have negated the conjunction, but at Zack's urging, I fixed both. I even did one extra bit of cleanup in moving the tkinter and os imports to the top where they belong. In my view, my patch was more than complete and this issue is fixed and should have remained closed and should be reclosed.Serhiy, when I wrote the tix patch, I was aware that tix remains buggy in that it will fail if a *user* imports tix, removes _default_root, and calls either of the functions that unconditionally access the attribute. Since test_tix only tests that the tix can be imported and that tix.Tk runs, there may be more bugs. And more cleanups might be needed. However, patching tix to work better is a different issue than this one. If you want, open a new issue, add some tests, and write the patch you outlined. | |||
| msg277376 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-09-25 13:54 | |
New changeset94a26aa1b1e0 by Serhiy Storchaka in branch '2.7':Issue#27611: Fixed support of default root window in the Tix module.https://hg.python.org/cpython/rev/94a26aa1b1e0New changeset7b458bcdab75 by Serhiy Storchaka in branch '3.5':Issue#27611: Fixed support of default root window in the tkinter.tix module.https://hg.python.org/cpython/rev/7b458bcdab75New changesetec3f5d21bec0 by Serhiy Storchaka in branch '3.6':Issue#27611: Fixed support of default root window in the tkinter.tix module.https://hg.python.org/cpython/rev/ec3f5d21bec0New changeset1c5e0dbcb2a0 by Serhiy Storchaka in branch 'default':Issue#27611: Fixed support of default root window in the tkinter.tix module.https://hg.python.org/cpython/rev/1c5e0dbcb2a0 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:34 | admin | set | github: 71798 |
| 2017-03-31 16:36:37 | dstufft | set | pull_requests: +pull_request1089 |
| 2016-09-25 14:45:24 | serhiy.storchaka | set | status: open -> closed |
| 2016-09-25 13:54:44 | python-dev | set | messages: +msg277376 |
| 2016-08-16 15:55:47 | terry.reedy | set | assignee:terry.reedy -> messages: +msg272862 |
| 2016-08-16 14:25:35 | serhiy.storchaka | set | messages: +msg272860 |
| 2016-08-16 07:19:24 | terry.reedy | set | messages: +msg272846 |
| 2016-08-16 07:09:46 | serhiy.storchaka | set | status: closed -> open messages: +msg272844 |
| 2016-08-16 05:46:09 | terry.reedy | set | status: open -> closed assignee:terry.reedy resolution: fixed stage: patch review -> resolved |
| 2016-08-16 05:44:52 | python-dev | set | messages: +msg272839 |
| 2016-08-16 04:11:24 | terry.reedy | set | messages: +msg272823 |
| 2016-08-16 04:10:31 | python-dev | set | messages: +msg272822 |
| 2016-07-25 04:37:35 | terry.reedy | set | messages: +msg271226 |
| 2016-07-25 04:32:09 | python-dev | set | nosy: +python-dev messages: +msg271225 |
| 2016-07-25 03:34:54 | zach.ware | set | nosy: +zach.ware messages: +msg271221 |
| 2016-07-25 03:10:06 | terry.reedy | set | messages: +msg271220 |
| 2016-07-25 03:02:43 | serhiy.storchaka | set | files: +tix_default_root.patch versions: + Python 2.7, Python 3.5 messages: +msg271219 keywords: +patch stage: patch review |
| 2016-07-25 02:07:16 | martin.panter | create | |