Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
fix issue with None values
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Oct 18, 2021
1 parent 40c013e commit 79b0735
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions cpyquickhelper/profiling/event_profiler.py
Expand Up @@ -202,8 +202,13 @@ def _choose(self, frame, arg, f_back=False):
function. This method returns its name.
"""
if arg is None:
name = (frame.f_back.f_code.co_name if f_back
else frame.f_code.co_name)
if f_back:
if frame.f_back is None:
name = ''
else:
name = frame.f_back.f_code.co_name
else:
name = frame.f_code.co_name
return name
return arg.__qualname__

Expand All @@ -215,9 +220,14 @@ def _choose_mod(self, frame, arg, clean_name, f_back=False):
function. This method returns its module.
"""
if arg is None:
name = clean_name(frame.f_back.f_code.co_name if f_back
else frame.f_code.co_name)
return name
if f_back:
if frame.f_back is None:
name = ''
else:
name = frame.f_back.f_code.co_filename
else:
name = frame.f_code.co_filename
return clean_name(name)
return arg.__module__

def retrieve_results(self, empty_cache=True, clean_file_name=None):
Expand Down

0 comments on commit 79b0735

Please sign in to comment.