@@ -176,47 +176,37 @@ function _showerror(io::IO, e::PyException, bt; backtrace = true)
176
176
pystr (String, x. lineno),
177
177
) for x in pyimport (" traceback" ). extract_tb (e. b)
178
178
]
179
- if Base. VERSION < v " 1.6.0-rc1"
180
- for (i, (name, fname, lineno)) in enumerate (reverse (fs))
181
- println (io)
182
- printstyled (io, " [" , i, " ] " )
183
- printstyled (io, name, bold = true )
184
- printstyled (io, " at " )
185
- printstyled (io, fname, " :" , lineno, bold = true )
186
- end
187
- else
188
- mcdict = Dict {String,Symbol} ()
189
- mccyclyer =
190
- Iterators. Stateful (Iterators. cycle (Base. STACKTRACE_MODULECOLORS))
191
- # skip a couple as a basic attempt to make the colours different from the Julia stacktrace
192
- popfirst! (mccyclyer)
193
- popfirst! (mccyclyer)
194
- for (i, (name, fname, lineno)) in enumerate (reverse (fs))
195
- println (io)
196
- printstyled (io, " [" , i, " ] " )
197
- printstyled (io, name, bold = true )
198
- println (io)
199
- printstyled (io, " @ " , color = :light_black )
200
- mod = file_to_pymodule (fname)
201
- if mod != = nothing
202
- # print the module, with colour determined by the top level name
203
- tmod = first (split (mod, " ." , limit = 2 ))
204
- color = get! (mcdict, tmod) do
205
- popfirst! (mccyclyer)
206
- end
207
- printstyled (io, mod, " " , color = color)
179
+ mcdict = Dict {String,Symbol} ()
180
+ mccyclyer =
181
+ Iterators. Stateful (Iterators. cycle (Base. STACKTRACE_MODULECOLORS))
182
+ # skip a couple as a basic attempt to make the colours different from the Julia stacktrace
183
+ popfirst! (mccyclyer)
184
+ popfirst! (mccyclyer)
185
+ for (i, (name, fname, lineno)) in enumerate (reverse (fs))
186
+ println (io)
187
+ printstyled (io, " [" , i, " ] " )
188
+ printstyled (io, name, bold = true )
189
+ println (io)
190
+ printstyled (io, " @ " , color = :light_black )
191
+ mod = file_to_pymodule (fname)
192
+ if mod != = nothing
193
+ # print the module, with colour determined by the top level name
194
+ tmod = first (split (mod, " ." , limit = 2 ))
195
+ color = get! (mcdict, tmod) do
196
+ popfirst! (mccyclyer)
208
197
end
209
- if isfile (fname) &&
210
- :stacktrace_contract_userdir in names (Base, all = true ) &&
211
- Base. stacktrace_contract_userdir ()
212
- if :replaceuserpath in names (Base, all = true )
213
- fname = Base. replaceuserpath (fname)
214
- elseif :contractuser in names (Base. Filesystem, all = true )
215
- fname = Base. Filesystem. contractuser (fname)
216
- end
198
+ printstyled (io, mod, " " , color = color)
199
+ end
200
+ if isfile (fname) &&
201
+ :stacktrace_contract_userdir in names (Base, all = true ) &&
202
+ Base. stacktrace_contract_userdir ()
203
+ if :replaceuserpath in names (Base, all = true )
204
+ fname = Base. replaceuserpath (fname)
205
+ elseif :contractuser in names (Base. Filesystem, all = true )
206
+ fname = Base. Filesystem. contractuser (fname)
217
207
end
218
- printstyled (io, fname, " :" , lineno, color = :light_black )
219
208
end
209
+ printstyled (io, fname, " :" , lineno, color = :light_black )
220
210
end
221
211
catch err
222
212
print (io, " <error while printing stacktrace: $err >" )
0 commit comments