Коммит ecabff23 создал по автору Durman's avatar Durman
Просмотр файлов

looks like with last numpy library the back trace can include non py files

this fix should search last py file
владелец 75f11376
......@@ -41,14 +41,18 @@ def catch_log_error():
def log_error(err):
"""Should be used in except statement"""
frame, _, line, *_ = inspect.trace()[-1]
module = inspect.getmodule(frame)
name = module.__name__ or "<Unknown Module>"
try_initialize()
_logger = logging.getLogger(f'{name}:{line} ')
_logger.error(err)
if _logger.isEnabledFor(logging.DEBUG):
traceback.print_exc()
for frame, _, line, *_ in inspect.trace()[::-1]:
module = inspect.getmodule(frame)
if module is None: # looks like frame points into non Python module
continue # try to find the module before
else:
name = module.__name__ or "<Unknown Module>"
try_initialize()
_logger = logging.getLogger(f'{name}:{line} ')
_logger.error(err)
if _logger.isEnabledFor(logging.DEBUG):
traceback.print_exc()
break
@contextmanager
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать