You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
turtle regression of issue #21823: "uncaught exception" on "AMD64 Snow Leop 3.x" buildbot #66083
Since the changeset 1ae2382417dcc7202c708cac46ae8a61412ca787 from the issue bpo-21823, Tcl/Tk crashs beacuse of an "uncaught exception" on the buildbot "AMD64 Snow Leop 3.x" on tk.call('update') called by tkinter.Misc().update().
Current thread 0x00007fff71296cc0 (most recent call first):
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/tkinter/__init__.py", line 963 in update
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 562 in _update
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 583 in _bgcolor
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 1239 in bgcolor
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 1024 in clear
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 995 in __init__
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 3689 in __init__
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 3661 in Screen
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtle.py", line 3829 in _getscreen
File "<string>", line 1 in mode
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtledemo/clock.py", line 17 in <module>
File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1420 in exec_module
File "<frozen importlib._bootstrap>", line 1149 in _load_unlocked
File "<frozen importlib._bootstrap>", line 2175 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2186 in _find_and_load
File "<string>", line 1 in <module>
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test___all__.py", line 23 in check_all
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test___all__.py", line 104 in test_all
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/case.py", line 577 in run
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/case.py", line 625 in __call__
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py", line 125 in run
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py", line 87 in __call__
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py", line 125 in run
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py", line 87 in __call__
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py", line 125 in run
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py", line 87 in __call__
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/runner.py", line 168 in run
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/support/__init__.py", line 1724 in _run_suite
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/support/__init__.py", line 1758 in run_unittest
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 1277 in <lambda>
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 1278 in runtest_inner
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 967 in runtest
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 532 in main
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 1562 in main_in_temp_cwd
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 1587 in <module>
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py", line 85 in _run_code
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py", line 170 in _run_module_as_main
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py", line 170, in _run_module_as_main"__main__", mod_spec)
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py", line 85, in _run_codeexec(code, run_globals)
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/__main__.py", line 3, in <module>
regrtest.main_in_temp_cwd()
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 1562, in main_in_temp_cwd
main()
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py", line 738, in mainraiseException("Child error on {}: {}".format(test, result[1]))
Exception: Child error on test___all__: Exit code -6make: *** [buildbottest] Error 1
program finished with exit code 2
elapsedTime=1584.387892
The problem is the mode call in clock.py, which I will move today as part of 21882.
I am sorely puzzled that the patch in bpo-21823 could have changed the effect of mode(). There are only two changes, only one of which could be relevant.
from turtle import *
+from turtle import Terminator # not in __all__
mode()
My understanding is that the newly added second import should just add a reference to Terminator in the existing module. It is a standard Exception subclass: from turtle.py, "class Terminator(Exception): pass". I could and will add 'Terminator' to __all__ instead, but it seems to me that the added statement *should* be innocuous.
What am I missing? Does __all__ change the import machinery in the calls to frozen importlib.bootstrap or do these call always happen behind the scene with any import? From the most recent first traceback:
...
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtledemo/clock.py", line 17 in <module>
File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1420 in exec_module
File "<frozen importlib._bootstrap>", line 1149 in _load_unlocked
File "<frozen importlib._bootstrap>", line 2175 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2186 in _find_and_load
File "<string>", line 1 in <module>
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test___all__.py", line 23 in check_all
...
Added a try:except: within a function, not called on import, to catch previously uncaught Terminator exception.
This is an instance of the problems identified in bpo-21882, namely that test___all__ is importing turtledemo modules and some of them have bad side effects. In this case, it's turtledemo.clock which is calling mode() which now unconditionally attempts to create a Tk window during the import. That means Tk is being called without being subject to the checks of test_support.requires('gui'). One of the reasons for having that check is to prevent this kind of crash (as documented in bpo-8716) in Tk when Tk is invoked in a process that cannot make a window manager connection, as when running under a buildbot with a user name that is not logged in as the main gui user. Note also that when Tk crashes, there is nothing the Python code can really do to recover from it. The solution is as outlined in bpo-21882: don't unconditionally call mode() in the import path.
Activity
vstinner commentedon Jun 30, 2014
Since the changeset 1ae2382417dcc7202c708cac46ae8a61412ca787 from the issue bpo-21823, Tcl/Tk crashs beacuse of an "uncaught exception" on the buildbot "AMD64 Snow Leop 3.x" on tk.call('update') called by tkinter.Misc().update().
First failure on the buildbot 3.4:
http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.4/builds/235
Last error on buildbot 3.x:
http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.x/builds/1831/steps/test/logs/stdio
Sun Jun 29 21:49:20 buddy.home.bitdance.com python.exe[75372] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
2014-06-29 21:49:22.399 python.exe[75372:903] An uncaught exception was raised
2014-06-29 21:49:22.400 python.exe[75372:903] Error (1002) creating CGSWindow
2014-06-29 21:49:22.419 python.exe[75372:903] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff84954784 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff84eb9f03 objc_exception_throw + 45
2 CoreFoundation 0x00007fff849545a7 +[NSException raise:format:arguments:] + 103
3 CoreFoundation 0x00007fff84954534 +[NSException raise:format:] + 148
4 AppKit 0x00007fff850a2f52 _NSCreateWindowWithOpaqueShape2 + 473
5 AppKit 0x00007fff85037691 -[NSWindow _commonAwake] + 1214
6 AppKit 0x00007fff850551c9 -[NSWindow _makeKeyRegardlessOfVisibility] + 96
7 AppKit 0x00007fff8505513e -[NSWindow makeKeyAndOrderFront:] + 24
8 Tk 0x00000001035fd86c XMapWindow + 155
9 Tk 0x000000010356c6d0 Tk_MapWindow + 89
10 Tk 0x00000001035755e6 TkToplevelWindowForCommand + 2658
11 Tcl 0x00000001034d20d3 TclServiceIdle + 76
12 Tcl 0x00000001034b82ce Tcl_DoOneEvent + 329
13 Tk 0x000000010354bf33 TkGetDisplayOf + 379
14 Tcl 0x0000000103454559 Tcl_CreateInterp + 4820
15 Tcl 0x0000000103455769 Tcl_EvalObjv + 66
16 _tkinter.so 0x0000000103433b4f Tkapp_Call + 562
17 python.exe 0x00000001000872af PyCFunction_Call + 202
18 python.exe 0x0000000100195bac call_function + 1715
19 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
20 python.exe 0x0000000100196256 fast_function + 515
21 python.exe 0x0000000100195df9 call_function + 2304
22 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
23 python.exe 0x0000000100196256 fast_function + 515
24 python.exe 0x0000000100195df9 call_function + 2304
25 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
26 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
27 python.exe 0x00000001001963aa fast_function + 855
28 python.exe 0x0000000100195df9 call_function + 2304
29 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
30 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
31 python.exe 0x00000001001963aa fast_function + 855
32 python.exe 0x0000000100195df9 call_function + 2304
33 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
34 python.exe 0x0000000100196256 fast_function + 515
35 python.exe 0x0000000100195df9 call_function + 2304
36 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
37 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
38 python.exe 0x00000001001963aa fast_function + 855
39 python.exe 0x0000000100195df9 call_function + 2304
40 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
41 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
42 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
43 python.exe 0x0000000100057fee function_call + 586
44 python.exe 0x000000010000e39f PyObject_Call + 126
45 python.exe 0x0000000100034224 method_call + 332
46 python.exe 0x000000010000e39f PyObject_Call + 126
47 python.exe 0x00000001000bf187 slot_tp_init + 76
48 python.exe 0x00000001000aaf04 type_call + 376
49 python.exe 0x000000010000e39f PyObject_Call + 126
50 python.exe 0x0000000100196c5c do_call + 553
51 python.exe 0x0000000100195e15 call_function + 2332
52 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
53 python.exe 0x0000000100196256 fast_function + 515
54 python.exe 0x0000000100195df9 call_function + 2304
55 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
56 python.exe 0x0000000100196256 fast_function + 515
57 python.exe 0x0000000100195df9 call_function + 2304
58 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
59 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
60 python.exe 0x00000001001963aa fast_function + 855
61 python.exe 0x0000000100195df9 call_function + 2304
62 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
63 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
64 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
65 python.exe 0x000000010017ce4f PyEval_EvalCode + 96
66 python.exe 0x0000000100174b34 builtin_exec + 550
67 python.exe 0x00000001000872af PyCFunction_Call + 202
68 python.exe 0x0000000100197338 ext_do_call + 1496
69 python.exe 0x000000010018e42b PyEval_EvalFrameEx + 71102
70 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
71 python.exe 0x00000001001963aa fast_function + 855
72 python.exe 0x0000000100195df9 call_function + 2304
73 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
74 python.exe 0x0000000100196256 fast_function + 515
75 python.exe 0x0000000100195df9 call_function + 2304
76 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
77 python.exe 0x0000000100196256 fast_function + 515
78 python.exe 0x0000000100195df9 call_function + 2304
79 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
80 python.exe 0x0000000100196256 fast_function + 515
81 python.exe 0x0000000100195df9 call_function + 2304
82 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
83 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
84 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
85 python.exe 0x0000000100057fee function_call + 586
86 python.exe 0x000000010000e39f PyObject_Call + 126
87 python.exe 0x000000010000f5f7 _PyObject_CallMethodIdObjArgs + 500
88 python.exe 0x00000001001c0ab1 PyImport_ImportModuleLevelObject + 3596
89 python.exe [160/390] test___all__
0x00000001001733f3 builtin___import__ + 164
90 python.exe 0x000000010008731b PyCFunction_Call + 310
91 python.exe 0x000000010000e39f PyObject_Call + 126
92 python.exe 0x000000010019529c PyEval_CallObjectWithKeywords + 417
93 python.exe 0x000000010018af53 PyEval_EvalFrameEx + 57574
94 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
95 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
96 python.exe 0x000000010017ce4f PyEval_EvalCode + 96
97 python.exe 0x00000001001d97c0 run_mod + 102
98 python.exe 0x00000001001d9442 PyRun_StringFlags + 179
99 python.exe 0x0000000100174ba1 builtin_exec + 659
100 python.exe 0x00000001000872af PyCFunction_Call + 202
101 python.exe 0x0000000100195bac call_function + 1715
102 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
103 python.exe 0x0000000100196256 fast_function + 515
104 python.exe 0x0000000100195df9 call_function + 2304
105 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
106 python.exe 0x0000000100196256 fast_function + 515
107 python.exe 0x0000000100195df9 call_function + 2304
108 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
109 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
110 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
111 python.exe 0x0000000100057fee function_call + 586
112 python.exe 0x000000010000e39f PyObject_Call + 126
113 python.exe 0x0000000100197352 ext_do_call + 1522
114 python.exe 0x000000010018e42b PyEval_EvalFrameEx + 71102
115 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
116 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
117 python.exe 0x0000000100057fee function_call + 586
118 python.exe 0x000000010000e39f PyObject_Call + 126
119 python.exe 0x0000000100034224 method_call + 332
120 python.exe 0x000000010000e39f PyObject_Call + 126
121 python.exe 0x00000001000be65f slot_tp_call + 77
122 python.exe 0x000000010000e39f PyObject_Call + 126
123 python.exe 0x0000000100196c5c do_call + 553
124 python.exe 0x0000000100195e15 call_function + 2332
125 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
126 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
127 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
128 python.exe 0x0000000100057fee function_call + 586
129 python.exe 0x000000010000e39f PyObject_Call + 126
130 python.exe 0x0000000100197352 ext_do_call + 1522
131 python.exe 0x000000010018e42b PyEval_EvalFrameEx + 71102
132 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
133 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
134 python.exe 0x0000000100057fee function_call + 586
135 python.exe 0x000000010000e39f PyObject_Call + 126
136 python.exe 0x0000000100034224 method_call + 332
137 python.exe 0x000000010000e39f PyObject_Call + 126
138 python.exe 0x00000001000be65f slot_tp_call + 77
139 python.exe 0x000000010000e39f PyObject_Call + 126
140 python.exe 0x0000000100196c5c do_call + 553
141 python.exe 0x0000000100195e15 call_function + 2332
142 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
143 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
144 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
145 python.exe 0x0000000100057fee function_call + 586
146 python.exe 0x000000010000e39f PyObject_Call + 126
147 python.exe 0x0000000100197352 ext_do_call + 1522
148 python.exe 0x000000010018e42b PyEval_EvalFrameEx + 71102
149 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
150 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
151 python.exe 0x0000000100057fee function_call + 586
152 python.exe 0x000000010000e39f PyObject_Call + 126
153 python.exe 0x0000000100034224 method_call + 332
154 python.exe 0x000000010000e39f PyObject_Call + 126
155 python.exe 0x00000001000be65f slot_tp_call + 77
156 python.exe 0x000000010000e39f PyObject_Call + 126
157 python.exe 0x0000000100196c5c do_call + 553
158 python.exe 0x0000000100195e15 call_function + 2332
159 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
160 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
161 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
162 python.exe 0x0000000100057fee function_call + 586
163 python.exe 0x000000010000e39f PyObject_Call + 126
164 python.exe 0x0000000100197352 ext_do_call + 1522
165 python.exe 0x000000010018e42b PyEval_EvalFrameEx + 71102
166 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
167 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
168 python.exe 0x0000000100057fee function_call + 586
169 python.exe 0x000000010000e39f PyObject_Call + 126
170 python.exe 0x0000000100034224 method_call + 332
171 python.exe 0x000000010000e39f PyObject_Call + 126
172 python.exe 0x00000001000be65f slot_tp_call + 77
173 python.exe 0x000000010000e39f PyObject_Call + 126
174 python.exe 0x0000000100196c5c do_call + 553
175 python.exe 0x0000000100195e15 call_function + 2332
176 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
177 python.exe 0x0000000100196256 fast_function + 515
178 python.exe 0x0000000100195df9 call_function + 2304
179 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
180 python.exe 0x0000000100196256 fast_function + 515
181 python.exe 0x0000000100195df9 call_function + 2304
182 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
183 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
184 python.exe 0x00000001001963aa fast_function + 855
185 python.exe 0x0000000100195df9 call_function + 2304
186 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
187 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
188 python.exe 0x00000001001963aa fast_function + 855
189 python.exe 0x0000000100195df9 call_function + 2304
190 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
191 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
192 python.exe 0x00000001001963aa fast_function + 855
193 python.exe 0x0000000100195df9 call_function + 2304
194 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
195 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
196 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
197 python.exe 0x0000000100057fee function_call + 586
198 python.exe 0x000000010000e39f PyObject_Call + 126
199 python.exe 0x0000000100197352 ext_do_call + 1522
200 python.exe 0x000000010018e42b PyEval_EvalFrameEx + 71102
201 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
202 python.exe 0x00000001001963aa fast_function + 855
203 python.exe 0x0000000100195df9 call_function + 2304
204 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
205 python.exe 0x0000000100196256 fast_function + 515
206 python.exe 0x0000000100195df9 call_function + 2304
207 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
208 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
209 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
210 python.exe 0x000000010017ce4f PyEval_EvalCode + 96
211 python.exe 0x0000000100174b34 builtin_exec + 550
212 python.exe 0x00000001000872af PyCFunction_Call + 202
213 python.exe 0x0000000100195bac call_function + 1715
214 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
215 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
216 python.exe 0x00000001001963aa fast_function + 855
217 python.exe 0x0000000100195df9 call_function + 2304
218 python.exe 0x000000010018df4f PyEval_EvalFrameEx + 69858
219 python.exe 0x0000000100193136 _PyEval_EvalCodeWithName + 4056
220 python.exe 0x00000001001932aa PyEval_EvalCodeEx + 136
221 python.exe 0x0000000100057fee function_call + 586
222 python.exe 0x000000010000e39f PyObject_Call + 126
223 python.exe 0x0000000100202f75 RunModule + 1048
224 python.exe 0x0000000100204638 Py_Main + 3670
225 python.exe 0x00000001000011cb main + 475
226 python.exe 0x0000000100000fe8 start + 52
)
terminate called after throwing an instance of 'NSException'
Fatal Python error: Aborted
terryjreedy commentedon Jun 30, 2014
(Brett, the question is about import.)
The problem is the mode call in clock.py, which I will move today as part of 21882.
I am sorely puzzled that the patch in bpo-21823 could have changed the effect of mode(). There are only two changes, only one of which could be relevant.
from turtle import *
+from turtle import Terminator # not in __all__
mode()
My understanding is that the newly added second import should just add a reference to Terminator in the existing module. It is a standard Exception subclass: from turtle.py, "class Terminator(Exception): pass". I could and will add 'Terminator' to __all__ instead, but it seems to me that the added statement *should* be innocuous.
What am I missing? Does __all__ change the import machinery in the calls to frozen importlib.bootstrap or do these call always happen behind the scene with any import? From the most recent first traceback:
...
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/turtledemo/clock.py", line 17 in <module>
File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1420 in exec_module
File "<frozen importlib._bootstrap>", line 1149 in _load_unlocked
File "<frozen importlib._bootstrap>", line 2175 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2186 in _find_and_load
File "<string>", line 1 in <module>
File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test___all__.py", line 23 in check_all
...
ned-deily commentedon Jun 30, 2014
This is an instance of the problems identified in bpo-21882, namely that test___all__ is importing turtledemo modules and some of them have bad side effects. In this case, it's turtledemo.clock which is calling mode() which now unconditionally attempts to create a Tk window during the import. That means Tk is being called without being subject to the checks of test_support.requires('gui'). One of the reasons for having that check is to prevent this kind of crash (as documented in bpo-8716) in Tk when Tk is invoked in a process that cannot make a window manager connection, as when running under a buildbot with a user name that is not logged in as the main gui user. Note also that when Tk crashes, there is nothing the Python code can really do to recover from it. The solution is as outlined in bpo-21882: don't unconditionally call mode() in the import path.