CLN: Use correct exception types in config.py machinery
CLN: simplify code in config.py
ENH: make set_option into a context_manager