diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-01-22 11:22:07 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-01-22 11:22:07 (GMT) |
commit | e3560a7dc9eeac324ff407588cb3f0b36ffe5c6e (patch) | |
tree | e366a51f86cbd7b3acb240a15da4135d03639584 | |
parent | ae8c078dbb93db3af982b7b42382e956af663185 (diff) | |
download | cpython-e3560a7dc9eeac324ff407588cb3f0b36ffe5c6e.zip cpython-e3560a7dc9eeac324ff407588cb3f0b36ffe5c6e.tar.gz cpython-e3560a7dc9eeac324ff407588cb3f0b36ffe5c6e.tar.bz2 |
site: error on sitecustomize import error
Issue #26099: The site module now writes an error into stderr if sitecustomize
module can be imported but executing the module raise an ImportError. Same
change for usercustomize.
-rw-r--r-- | Lib/site.py | 20 | ||||
-rw-r--r-- | Misc/NEWS | 4 |
2 files changed, 18 insertions, 6 deletions
diff --git a/Lib/site.py b/Lib/site.py index 3a8d1c3..13ec8fa 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -504,9 +504,13 @@ def venv(known_paths): def execsitecustomize(): """Run custom site specific code, if available.""" try: - import sitecustomize - except ImportError: - pass + try: + import sitecustomize + except ImportError as exc: + if exc.name == 'sitecustomize': + pass + else: + raise except Exception as err: if os.environ.get("PYTHONVERBOSE"): sys.excepthook(*sys.exc_info()) @@ -520,9 +524,13 @@ def execsitecustomize(): def execusercustomize(): """Run custom user specific code, if available.""" try: - import usercustomize - except ImportError: - pass + try: + import usercustomize + except ImportError as exc: + if exc.name == 'usercustomize': + pass + else: + raise except Exception as err: if os.environ.get("PYTHONVERBOSE"): sys.excepthook(*sys.exc_info()) @@ -146,6 +146,10 @@ Core and Builtins Library ------- +- Issue #26099: The site module now writes an error into stderr if + sitecustomize module can be imported but executing the module raise an + ImportError. Same change for usercustomize. + - Issue #26147: xmlrpc now works with strings not encodable with used non-UTF-8 encoding. |