bpo-34791: xml package obeys ignore env flags (GH-9544) (GH-9547)
The xml.sax and xml.dom.domreg modules now obey
sys.flags.ignore_environment.
Signed-off-by: Christian Heimes <christian@python.org>
https://bugs.python.org/issue34791
(cherry picked from commit 223e501fb9
)
Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
5744a33629
commit
2546ac8eeb
|
@ -8,6 +8,8 @@ from xml.dom.minicompat import * # isinstance, StringTypes
|
|||
# should be published by posting to xml-sig@python.org, and are
|
||||
# subsequently recorded in this file.
|
||||
|
||||
import sys
|
||||
|
||||
well_known_implementations = {
|
||||
'minidom':'xml.dom.minidom',
|
||||
'4DOM': 'xml.dom.DOMImplementation',
|
||||
|
@ -57,7 +59,7 @@ def getDOMImplementation(name = None, features = ()):
|
|||
return mod.getDOMImplementation()
|
||||
elif name:
|
||||
return registered[name]()
|
||||
elif "PYTHON_DOM" in os.environ:
|
||||
elif not sys.flags.ignore_environment and "PYTHON_DOM" in os.environ:
|
||||
return getDOMImplementation(name = os.environ["PYTHON_DOM"])
|
||||
|
||||
# User did not specify a name, try implementations in arbitrary
|
||||
|
|
|
@ -59,7 +59,7 @@ if _false:
|
|||
import xml.sax.expatreader
|
||||
|
||||
import os, sys
|
||||
if "PY_SAX_PARSER" in os.environ:
|
||||
if not sys.flags.ignore_environment and "PY_SAX_PARSER" in os.environ:
|
||||
default_parser_list = os.environ["PY_SAX_PARSER"].split(",")
|
||||
del os
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
The xml.sax and xml.dom.domreg no longer use environment variables to
|
||||
override parser implementations when sys.flags.ignore_environment is set by
|
||||
-E or -I arguments.
|
Loading…
Reference in New Issue