[Python-checkins] cpython (2.7): Fixes #4686. Reverts redundant picklability code from r74544.

lukasz.langa python-checkins at python.org
Mon Jan 23 17:31:47 CET 2012


http://hg.python.org/cpython/rev/8e091e36fc80
changeset: 74581:8e091e36fc80
branch: 2.7
parent: 74560:fcf4d547bed8
user: Łukasz Langa <lukasz at langa.pl>
date: Mon Jan 23 17:30:53 2012 +0100
summary:
 Fixes #4686. Reverts redundant picklability code from r74544.
files:
 Lib/ConfigParser.py | 42 +++++++-------------------------
 1 files changed, 9 insertions(+), 33 deletions(-)
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py
--- a/Lib/ConfigParser.py
+++ b/Lib/ConfigParser.py
@@ -134,9 +134,6 @@
 def __repr__(self):
 return self.message
 
- def __reduce__(self):
- return self.__class__, (self.message,)
-
 __str__ = __repr__
 
 class NoSectionError(Error):
@@ -145,9 +142,7 @@
 def __init__(self, section):
 Error.__init__(self, 'No section: %r' % (section,))
 self.section = section
-
- def __reduce__(self):
- return self.__class__, (self.section,)
+ self.args = (section, )
 
 class DuplicateSectionError(Error):
 """Raised when a section is multiply-created."""
@@ -155,9 +150,7 @@
 def __init__(self, section):
 Error.__init__(self, "Section %r already exists" % section)
 self.section = section
-
- def __reduce__(self):
- return self.__class__, (self.section,)
+ self.args = (section, )
 
 class NoOptionError(Error):
 """A requested option was not found."""
@@ -167,9 +160,7 @@
 (option, section))
 self.option = option
 self.section = section
-
- def __reduce__(self):
- return self.__class__, (self.option, self.section)
+ self.args = (option, section)
 
 class InterpolationError(Error):
 """Base class for interpolation-related exceptions."""
@@ -178,9 +169,7 @@
 Error.__init__(self, msg)
 self.option = option
 self.section = section
-
- def __reduce__(self):
- return self.__class__, (self.option, self.section, self.message)
+ self.args = (option, section, msg)
 
 class InterpolationMissingOptionError(InterpolationError):
 """A string substitution required a setting which was not available."""
@@ -194,11 +183,7 @@
 % (section, option, reference, rawval))
 InterpolationError.__init__(self, option, section, msg)
 self.reference = reference
- self._rawval = rawval
-
- def __reduce__(self):
- return self.__class__, (self.option, self.section, self._rawval,
- self.reference)
+ self.args = (option, section, rawval, reference)
 
 class InterpolationSyntaxError(InterpolationError):
 """Raised when the source text into which substitutions are made
@@ -214,28 +199,21 @@
 "\trawval : %s\n"
 % (section, option, rawval))
 InterpolationError.__init__(self, option, section, msg)
- self._rawval = rawval
-
- def __reduce__(self):
- return self.__class__, (self.option, self.section, self._rawval)
+ self.args = (option, section, rawval)
 
 class ParsingError(Error):
 """Raised when a configuration file does not follow legal syntax."""
 
- def __init__(self, filename, _errors=[]):
+ def __init__(self, filename):
 Error.__init__(self, 'File contains parsing errors: %s' % filename)
 self.filename = filename
 self.errors = []
- for lineno, line in _errors:
- self.append(lineno, line)
+ self.args = (filename, )
 
 def append(self, lineno, line):
 self.errors.append((lineno, line))
 self.message += '\n\t[line %2d]: %s' % (lineno, line)
 
- def __reduce__(self):
- return self.__class__, (self.filename, self.errors)
-
 class MissingSectionHeaderError(ParsingError):
 """Raised when a key-value pair is found before any section header."""
 
@@ -247,9 +225,7 @@
 self.filename = filename
 self.lineno = lineno
 self.line = line
-
- def __reduce__(self):
- return self.__class__, (self.filename, self.lineno, self.line)
+ self.args = (filename, lineno, line)
 
 
 class RawConfigParser:
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /