Skip to content

Commit

Permalink
it is possible for getmodule to return None (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
algrs authored Jun 27, 2016
1 parent 5b6c787 commit 5dbc4b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion harrison/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from harrison.profile import profile
from harrison.timer import Timer

__version__ = '1.1.0'
__version__ = '1.1.1'
6 changes: 5 additions & 1 deletion harrison/util/inspectlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def stack_frame_info(stacklevel):
raise ValueError('A stacklevel less than 1 is pointless')

frame, filename, line_number, function_name, _, _ = inspect.stack()[stacklevel]
module_name = inspect.getmodule(frame).__name__
module = inspect.getmodule(frame) # it is possible for getmodule to return None
if module is not None:
module_name = module.__name__
else:
module_name = ""

return Where(
filename=filename,
Expand Down

0 comments on commit 5dbc4b5

Please sign in to comment.