diff options
author | Christian Heimes <christian@python.org> | 2018-09-24 17:21:12 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-09-24 17:21:12 (GMT) |
commit | 223e501fb9c2b6ae21b96054e20c4c31d94a5d96 (patch) | |
tree | b3fd130b823aba8f38732cae4457910cbe2ba5d2 /Lib/xml | |
parent | a46467ff198c42c8f34768c7be4b4562f6f44736 (diff) | |
download | cpython-223e501fb9c2b6ae21b96054e20c4c31d94a5d96.zip cpython-223e501fb9c2b6ae21b96054e20c4c31d94a5d96.tar.gz cpython-223e501fb9c2b6ae21b96054e20c4c31d94a5d96.tar.bz2 |
bpo-34791: xml package obeys ignore env flags (GH-9544)
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
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/dom/domreg.py | 4 | ||||
-rw-r--r-- | Lib/xml/sax/__init__.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/xml/dom/domreg.py b/Lib/xml/dom/domreg.py index 8c3d901..69c17ee 100644 --- a/Lib/xml/dom/domreg.py +++ b/Lib/xml/dom/domreg.py @@ -6,6 +6,8 @@ registerDOMImplementation should be imported from xml.dom.""" # 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', @@ -55,7 +57,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 diff --git a/Lib/xml/sax/__init__.py b/Lib/xml/sax/__init__.py index ef67ae6..13f6cf5 100644 --- a/Lib/xml/sax/__init__.py +++ b/Lib/xml/sax/__init__.py @@ -58,7 +58,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 |