code: def set(self, section, option, value=None):
          
          # The only legal non-string value if we allow valueless
          # options is None, so we need to check if the value is a
          # string if:
          # - we do not allow valueless options, or
          # - we allow valueless options but the value is not None
          if self._optcre is self.OPTCRE or value:
              if not isinstance(value, basestring):
                  raise TypeError("option values must be strings")
          if value is not None:
              # check for bad percent signs:
              # first, replace all "good" interpolations
              tmp_value = value.replace('%%', '')
              tmp_value = self._interpvar_re.sub('', tmp_value)
              # then, check if there's a lone percent sign left
              if '%' in tmp_value:
                  raise ValueError("invalid interpolation syntax in %r at "
                                  "position %d" % (value, tmp_value.find('%')))
          ConfigParser.set(self, section, option, value)
docs: Set an option.  Extend ConfigParser.set: check for string values.