Some small fixes to the new options implementation.

Review Request #1236 - Created Oct. 29, 2014 and submitted

Information
Benjy Weinberger
pants
a78f30d...
Reviewers
pants-reviews
johanoskarsson, patricklaw, zundel

These all relate to options whose action is 'append', and address rare corner cases.

  1. Switch some invocations of copy() to deepcopy(), to ensure e.g., that
    default values of list type are not shared between the
    parser we use to generate help and the parser we use to actually
    parse args.

  2. Distinguish between an empty list value in config, and no value at all.
    This ensures that "no value" doesn't trump a hard-coded default because
    we mistake it for an explicit config value.

  3. Don't special-case appends to RankedValue. Instead make copy()
    return the underlying value. argparse is the only thing that calls copy()
    on a RankedValue, and this will ensure that argparse always works with
    raw values, both in the list case and (as before) in the single value case.

  4. Nits: Remove an unused import, break up an overlong line.

Various manual tests of corner cases that could trigger these issues. CI running.

Ity Kaul
Eric Ayers
Eric Ayers
Benjy Weinberger
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted as b71650905e11ae9be48344af951122af4c642942.
Loading...