mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
In getdef(), don't die when the section doesn't exist.
This commit is contained in:
parent
074d6e1f56
commit
7f3cfd50fa
1 changed files with 2 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from ConfigParser import ConfigParser, NoOptionError
|
from ConfigParser import ConfigParser, NoOptionError, NoSectionError
|
||||||
|
|
||||||
class IdleConfParser(ConfigParser):
|
class IdleConfParser(ConfigParser):
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ class IdleConfParser(ConfigParser):
|
||||||
"""Get an option value for given section or return default"""
|
"""Get an option value for given section or return default"""
|
||||||
try:
|
try:
|
||||||
return self.get(sec, options, raw, vars)
|
return self.get(sec, options, raw, vars)
|
||||||
except NoOptionError:
|
except (NoSectionError, NoOptionError):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def getsection(self, section):
|
def getsection(self, section):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue