diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2012-08-16 15:17:29 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2012-08-16 15:17:29 +0000 |
| commit | e5dc45f398787d5f23566a000974511afc89e50b (patch) | |
| tree | e85f7b590dd6e8a48e5c1f2f726d777dc7022726 /docutils/writers/docutils_xml.py | |
| parent | 0b853f7efb2ea4ac31f213d20eb2af70655b624b (diff) | |
| download | docutils-e5dc45f398787d5f23566a000974511afc89e50b.tar.gz | |
Fix [ 3552403 ] Prevent broken PyXML replacing stdlibs xml module.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@7497 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/writers/docutils_xml.py')
| -rw-r--r-- | docutils/writers/docutils_xml.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docutils/writers/docutils_xml.py b/docutils/writers/docutils_xml.py index c9ee2f09c..e4a44fb5c 100644 --- a/docutils/writers/docutils_xml.py +++ b/docutils/writers/docutils_xml.py @@ -11,6 +11,19 @@ http://docutils.sourceforge.net/docs/ref/docutils.dtd. __docformat__ = 'reStructuredText' import sys + +# Work around broken PyXML and obsolete python stdlib behaviour. (The stdlib +# replaces its own xml module with PyXML if the latter is installed. However, +# PyXML is no longer maintained and partially incompatible/buggy.) Reverse +# the order in which xml module and submodules are searched to import stdlib +# modules if they exist and PyXML modules if they do not exist in the stdlib. +# +# See http://sourceforge.net/tracker/index.php?func=detail&aid=3552403&group_id=38414&atid=422030 +# and http://lists.fedoraproject.org/pipermail/python-devel/2012-July/000406.html +import xml +if "_xmlplus" in xml.__path__[0]: # PyXML sub-module + xml.__path__.reverse() # If both are available, prefer stdlib over PyXML + import xml.sax.saxutils from StringIO import StringIO |
