annotate Lib/xml/__init__.py @ 25838:8540887bcec6 2.2

Backport of 2.183: Fix memory leak in add_subclass() found by NealN with valgrind.
author Guido van Rossum <guido@python.org>
date Fri, 18 Oct 2002 13:42:21 +0000
parents 141230956325
children b128255c2bea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13142
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
1 """Core XML support for Python.
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
2
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
3 This package contains three sub-packages:
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
4
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
5 dom -- The W3C Document Object Model. This supports DOM Level 1 +
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 Namespaces.
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7
13779
ab42d4542424 Add magic to replace the xml package with _xmlplus at import time.
Fred Drake <fdrake@acm.org>
parents: 13307
diff changeset
8 parsers -- Python wrappers for XML parsers (currently only supports Expat).
13142
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
9
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10 sax -- The Simple API for XML, developed by XML-Dev, led by David
15307
f8721e849424 Make reindent.py happy (lots of trailing whitespace removed).
Fred Drake <fdrake@acm.org>
parents: 14847
diff changeset
11 Megginson and ported to Python by Lars Marius Garshol. This
13284
5102effb0c4b Reference cycle fixes
Paul Prescod <prescod@prescod.net>
parents: 13142
diff changeset
12 supports the SAX 2 API.
13142
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
13 """
13779
ab42d4542424 Add magic to replace the xml package with _xmlplus at import time.
Fred Drake <fdrake@acm.org>
parents: 13307
diff changeset
14
ab42d4542424 Add magic to replace the xml package with _xmlplus at import time.
Fred Drake <fdrake@acm.org>
parents: 13307
diff changeset
15
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
16 __all__ = ["dom", "parsers", "sax"]
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
17
17231
bf4cc99d711d Use Guido's trick for always extracting the version number from a
Martin v. Löwis <martin@v.loewis.de>
parents: 16519
diff changeset
18 # When being checked-out without options, this has the form
bf4cc99d711d Use Guido's trick for always extracting the version number from a
Martin v. Löwis <martin@v.loewis.de>
parents: 16519
diff changeset
19 # "<dollar>Revision: x.y </dollar>"
bf4cc99d711d Use Guido's trick for always extracting the version number from a
Martin v. Löwis <martin@v.loewis.de>
parents: 16519
diff changeset
20 # When exported using -kv, it is "x.y".
17236
141230956325 Arghh. Fix typo.
Martin v. Löwis <martin@v.loewis.de>
parents: 17231
diff changeset
21 __version__ = "$Revision$".split()[-2:][0]
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
22
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
23
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
24 _MINIMUM_XMLPLUS_VERSION = (0, 6, 1)
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
25
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
26
13849
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
27 try:
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
28 import _xmlplus
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
29 except ImportError:
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
30 pass
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
31 else:
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
32 try:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
33 v = _xmlplus.version_info
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
34 except AttributeError:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
35 # _xmlplue is too old; ignore it
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
36 pass
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
37 else:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
38 if v >= _MINIMUM_XMLPLUS_VERSION:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
39 import sys
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
40 sys.modules[__name__] = _xmlplus
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
41 else:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
42 del v