Skip to content

Replace eval with ast.literal_eval in apptools.preferences#299

Merged
corranwebster merged 3 commits into
mainfrom
enh/better-preferences-deserialization
Sep 17, 2021
Merged

Replace eval with ast.literal_eval in apptools.preferences#299
corranwebster merged 3 commits into
mainfrom
enh/better-preferences-deserialization

Conversation

@corranwebster
Copy link
Copy Markdown
Contributor

@corranwebster corranwebster commented Sep 17, 2021

We don't need the full power of eval() here, literal_eval() should do everything we need, is safer, and anything which breaks can be modified to use a custom trait that is more focused. This change doesn't break any existing tests, but includes a new test that something which should fail due to the change, does.

Checklist

  • Add a news fragment if this PR is news-worthy for end users. (see docs/releases/README.rst)

We don't need the full power of eval() here, literal_eval() should do
everything we need, is safer, and anything which breaks can be modified to
use a custom trait that is more focused.
Copy link
Copy Markdown
Member

@jwiggins jwiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@corranwebster corranwebster merged commit 7f107dc into main Sep 17, 2021
@corranwebster corranwebster deleted the enh/better-preferences-deserialization branch September 17, 2021 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants