[Python-checkins] cpython (2.7): Issue #21990: Cleanup unnecessary inner class definition in saxutils.
raymond.hettinger
python-checkins at python.org
Fri Jul 25 19:26:45 CEST 2014
http://hg.python.org/cpython/rev/a5cb10f2dbaa
changeset: 91860:a5cb10f2dbaa
branch: 2.7
parent: 91848:f7c84674bdec
user: Raymond Hettinger <python at rcn.com>
date: Fri Jul 25 10:26:36 2014 -0700
summary:
Issue #21990: Cleanup unnecessary inner class definition in saxutils.
files:
Lib/xml/sax/saxutils.py | 13 ++++++++-----
Misc/NEWS | 3 +++
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py
--- a/Lib/xml/sax/saxutils.py
+++ b/Lib/xml/sax/saxutils.py
@@ -98,14 +98,17 @@
except AttributeError:
pass
# wrap a binary writer with TextIOWrapper
- class UnbufferedTextIOWrapper(io.TextIOWrapper):
- def write(self, s):
- super(UnbufferedTextIOWrapper, self).write(s)
- self.flush()
- return UnbufferedTextIOWrapper(buffer, encoding=encoding,
+ return _UnbufferedTextIOWrapper(buffer, encoding=encoding,
errors='xmlcharrefreplace',
newline='\n')
+
+class _UnbufferedTextIOWrapper(io.TextIOWrapper):
+ def write(self, s):
+ super(_UnbufferedTextIOWrapper, self).write(s)
+ self.flush()
+
+
class XMLGenerator(handler.ContentHandler):
def __init__(self, out=None, encoding="iso-8859-1"):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,6 +17,9 @@
socket.error() exceptions with blocking I/O errors: EAGAIN, EALREADY,
EINPROGRESS, or EWOULDBLOCK.
+- Issue #21990: Clean-up unnecessary and slow inner class definition in
+ saxutils (Contributed by Alex Gaynor).
+
- Issue #1730136: Fix the comparison between a tkFont.Font and an object of
another kind.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list