Skip to content

Commit

Permalink
Fix exception handling on eval of arguments in edge case, 0.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Jul 24, 2023
1 parent 21d037d commit 712a943
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions easycompletion/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def parse_arguments(arguments, debug=DEBUG):
arguments = re.sub(r"[^\x00-\x7F]+", "", arguments)
arguments = json.loads(arguments)
# If everything fails, try Python's eval function
except (ValueError, SyntaxError):
except Exception:
try:
arguments = eval(arguments)
except (ValueError, SyntaxError):
except Exception:
arguments = None
log(f"Arguments:\n{str(arguments)}", log=debug)
return arguments
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name="easycompletion",
version='0.2.9',
version='0.2.10',
description="Easy text completion and function calling using the OpenAI API. Also includes useful utilities for counting tokens, composing prompts and trimming them to fit within the token limit.",
long_description=long_description, # added this line
long_description_content_type="text/markdown", # and this line
Expand Down

0 comments on commit 712a943

Please sign in to comment.