Skip to content

Fix config file type coercion (Issue 311)#450

Open
rannoww wants to merge 1 commit intotrailofbits:masterfrom
rannoww:fix/311-config-type-coercion
Open

Fix config file type coercion (Issue 311)#450
rannoww wants to merge 1 commit intotrailofbits:masterfrom
rannoww:fix/311-config-type-coercion

Conversation

@rannoww
Copy link
Copy Markdown

@rannoww rannoww commented Apr 25, 2026

Fixes #311

configparser returns all values as strings, so arguments like
timeout and mem_limit loaded from a config file were stored as
"36000" instead of 36000, causing a TypeError at runtime when
arithmetic was performed on them.

Changes

  • Added an optional type_map parameter to build_from_config() that
    maps argument names to their expected types
  • In parse_args(), build that type map from argparse's registered
    actions and pass it into build_from_config()
  • Handle store_true/store_false boolean actions as a special case

##Notes
-Done for class CS386 group members Tate Rannow and Zain Elsafty. I am submitting the PR for the both of us.

configparser returns all values as strings regardless of intended type. We built a type map from argparse's registered actions and use it in build_from_config() to force values to the correct types before they merge into pared args.

FIxes#311
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 25, 2026

CLA assistant check
All committers have signed the CLA.

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.

running deepstate with config file -> types recognition bug

2 participants