File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -241,25 +241,20 @@ def getsource(self, astcache=None):
241
241
242
242
def ishidden (self ):
243
243
""" return True if the current frame has a var __tracebackhide__
244
- resolving to True
244
+ resolving to True.
245
245
246
246
If __tracebackhide__ is a callable, it gets called with the
247
247
ExceptionInfo instance and can decide whether to hide the traceback.
248
248
249
249
mostly for internal use
250
250
"""
251
- try :
252
- tbh = self .frame .f_locals ["__tracebackhide__" ]
253
- except KeyError :
254
- try :
255
- tbh = self .frame .f_globals ["__tracebackhide__" ]
256
- except KeyError :
257
- return False
258
-
259
- if callable (tbh ):
251
+ f = self .frame
252
+ tbh = f .f_locals .get (
253
+ "__tracebackhide__" , f .f_globals .get ("__tracebackhide__" , False )
254
+ )
255
+ if tbh and callable (tbh ):
260
256
return tbh (None if self ._excinfo is None else self ._excinfo ())
261
- else :
262
- return tbh
257
+ return tbh
263
258
264
259
def __str__ (self ):
265
260
try :
You can’t perform that action at this time.
0 commit comments