Comment 2 for bug 1540959

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.config (master)

Reviewed: https://review.openstack.org/275307
Committed: https://git.openstack.org/cgit/openstack/oslo.config/commit/?id=068784afab28631b2a8fcd5dbc55a777508f63b6
Submitter: Jenkins
Branch: master

commit 068784afab28631b2a8fcd5dbc55a777508f63b6
Author: Alexis Lee <email address hidden>
Date: Tue Feb 2 16:19:20 2016 +0000

    Fix unrecognized subparser args

    Someone thought a transient attr would be a clever way to smuggle data
    from a _SubParsersAction up to the main ArgumentsParser. Unfortunately
    they use a really weird way to set the attr:

        vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])

    This bypasses __setattr__ so when they try to delattr later,
    __delattr__ can't find it and bombs. Even though the delattr is
    protected by a hasattr, because hasattr uses getattr which checks the
    private object dict first before calling __getattr__.

    Handle this by falling back to super in __getattr__ and __delattr__.

    Change-Id: Id89a0c00fd32b6580d891ccf69d58fa17f11ec49
    Closes-Bug: #1540959