diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-05-09 06:10:38 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-05-09 06:10:38 (GMT) |
commit | 867754e3e3c907f87d1bb0282df628deb392cd62 (patch) | |
tree | 3a5acb5ba081b355ea94fa237ec940c47c0d4418 /Lib | |
parent | 8ffaa1049c8e3e18b7615f4eecc9dfd71495f3ba (diff) | |
parent | 2f48d892d4036b500f5b79d152b3166b4d205dc9 (diff) | |
download | cpython-867754e3e3c907f87d1bb0282df628deb392cd62.zip cpython-867754e3e3c907f87d1bb0282df628deb392cd62.tar.gz cpython-867754e3e3c907f87d1bb0282df628deb392cd62.tar.bz2 |
merge 11164
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/modulefinder.py | 7 | ||||
-rw-r--r-- | Lib/test/test_minidom.py | 20 | ||||
-rw-r--r-- | Lib/test/test_sax.py | 45 | ||||
-rw-r--r-- | Lib/xml/__init__.py | 21 |
4 files changed, 4 insertions, 89 deletions
diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py index 646a785..f033ba9 100644 --- a/Lib/modulefinder.py +++ b/Lib/modulefinder.py @@ -35,9 +35,10 @@ def AddPackagePath(packagename, path): replacePackageMap = {} -# This ReplacePackage mechanism allows modulefinder to work around the -# way the _xmlplus package injects itself under the name "xml" into -# sys.modules at runtime by calling ReplacePackage("_xmlplus", "xml") +# This ReplacePackage mechanism allows modulefinder to work around +# situations in which a package injects itself under the name +# of another package into sys.modules at runtime by calling +# ReplacePackage("real_package_name", "faked_package_name") # before running ModuleFinder. def ReplacePackage(oldname, newname): diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 4c2b34a..200b95d 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -45,26 +45,6 @@ def create_doc_with_doctype(): return doc class MinidomTest(unittest.TestCase): - def tearDown(self): - try: - Node.allnodes - except AttributeError: - # We don't actually have the minidom from the standard library, - # but are picking up the PyXML version from site-packages. - pass - else: - self.confirm(len(Node.allnodes) == 0, - "assertion: len(Node.allnodes) == 0") - if len(Node.allnodes): - print("Garbage left over:") - if verbose: - print(list(Node.allnodes.items())[0:10]) - else: - # Don't print specific nodes if repeatable results - # are needed - print(len(Node.allnodes)) - Node.allnodes = {} - def confirm(self, test, testname = "Test"): self.assertTrue(test, testname) diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index 0f6a1ca..1225d6e 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -794,51 +794,6 @@ class XmlReaderTest(XmlTestBase): self.assertEqual(attrs.getQNameByName((ns_uri, "attr")), "ns:attr") - # During the development of Python 2.5, an attempt to move the "xml" - # package implementation to a new package ("xmlcore") proved painful. - # The goal of this change was to allow applications to be able to - # obtain and rely on behavior in the standard library implementation - # of the XML support without needing to be concerned about the - # availability of the PyXML implementation. - # - # While the existing import hackery in Lib/xml/__init__.py can cause - # PyXML's _xmlpus package to supplant the "xml" package, that only - # works because either implementation uses the "xml" package name for - # imports. - # - # The move resulted in a number of problems related to the fact that - # the import machinery's "package context" is based on the name that's - # being imported rather than the __name__ of the actual package - # containment; it wasn't possible for the "xml" package to be replaced - # by a simple module that indirected imports to the "xmlcore" package. - # - # The following two tests exercised bugs that were introduced in that - # attempt. Keeping these tests around will help detect problems with - # other attempts to provide reliable access to the standard library's - # implementation of the XML support. - - def test_sf_1511497(self): - # Bug report: http://www.python.org/sf/1511497 - import sys - old_modules = sys.modules.copy() - for modname in list(sys.modules.keys()): - if modname.startswith("xml."): - del sys.modules[modname] - try: - import xml.sax.expatreader - module = xml.sax.expatreader - self.assertEqual(module.__name__, "xml.sax.expatreader") - finally: - sys.modules.update(old_modules) - - def test_sf_1513611(self): - # Bug report: http://www.python.org/sf/1513611 - sio = StringIO("invalid") - parser = make_parser() - from xml.sax import SAXParseException - self.assertRaises(SAXParseException, parser.parse, sio) - - def test_main(): run_unittest(MakeParserTest, SaxutilsTest, diff --git a/Lib/xml/__init__.py b/Lib/xml/__init__.py index deed983..bf6d8dd 100644 --- a/Lib/xml/__init__.py +++ b/Lib/xml/__init__.py @@ -18,24 +18,3 @@ etree -- The ElementTree XML library. This is a subset of the full __all__ = ["dom", "parsers", "sax", "etree"] - -_MINIMUM_XMLPLUS_VERSION = (0, 8, 4) - - -try: - import _xmlplus -except ImportError: - pass -else: - try: - v = _xmlplus.version_info - except AttributeError: - # _xmlplus is too old; ignore it - pass - else: - if v >= _MINIMUM_XMLPLUS_VERSION: - import sys - _xmlplus.__path__.extend(__path__) - sys.modules[__name__] = _xmlplus - else: - del v |