Skip to content

Commit

Permalink
Fix validation of log level name for Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Jul 27, 2021
1 parent f7283bf commit 8c5ccd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pwnlib/context/__init__.py
Expand Up @@ -972,7 +972,10 @@ def log_level(self, value):
except AttributeError: pass

# Otherwise, fail
level_names = filter(lambda x: isinstance(x,str), logging._levelNames)
if sys.version_info[0] < 3:
level_names = filter(lambda x: isinstance(x,str), logging._levelNames)
else:
level_names = list(logging._levelToName.values())
permitted = sorted(level_names)
raise AttributeError('log_level must be an integer or one of %r' % permitted)

Expand Down

0 comments on commit 8c5ccd0

Please sign in to comment.