Skip to content

Commit

Permalink
Update simpleeval.py
Browse files Browse the repository at this point in the history
changes requested by maintainer

Co-Authored-By: Daniel <[email protected]>
  • Loading branch information
shughes-uk and danthedeckie authored Apr 7, 2020
1 parent 70f3bcd commit 3115c6b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions simpleeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,12 @@
# their functionality is required, then please wrap them up in a safe container. And think
# very hard about it first. And don't say I didn't warn you.
# builtins is a dict in python >3.6 but a module before
if isinstance(__builtins__, dict) and 'help' in __builtins__:
DISALLOW_FUNCTIONS = {
type, isinstance, eval, getattr, setattr, help, repr, compile, open
}
elif 'help' in dir(__builtins__):
DISALLOW_FUNCTIONS = {
type, isinstance, eval, getattr, setattr, help, repr, compile, open
}
else:
print('help not in builtins')

DISALLOW_FUNCTIONS = {
DISALLOW_FUNCTIONS = {
type, isinstance, eval, getattr, setattr, repr, compile, open
}
if hasattr(__builtins__, 'help') or 'help' in __builtins__:
# PyInstaller environment doesn't include this module.
DISALLOW_FUNCTIONS.add(help)


if PYTHON3:
Expand Down

0 comments on commit 3115c6b

Please sign in to comment.