# HG changeset patch # User Gregory Szorc # Date 1570309262 14400 # Node ID 5c9c71cde1c92351567a2e651cf05bc736991210 # Parent 058c2468b2f528c886072e7cf58e81f2a072ef74 hg: remove HGUNICODEPEDANTRY and RTUNICODEPEDANTRY This was added in 73e4a02e6d23 and 89822d7a9d5f as a preliminary way to better support Python 3. With the Python 3 port nearly done and better procedures in place, we shouldn't need it. Differential Revision: https://phab.mercurial-scm.org/D6991 diff -r 058c2468b2f5 -r 5c9c71cde1c9 hg --- a/hg Fri Oct 04 16:07:32 2019 -0400 +++ b/hg Sat Oct 05 17:01:02 2019 -0400 @@ -11,13 +11,6 @@ import os import sys -if os.environ.get('HGUNICODEPEDANTRY', False): - try: - reload(sys) - sys.setdefaultencoding("undefined") - except NameError: - pass - libdir = '@LIBDIR@' if libdir != '@' 'LIBDIR' '@': diff -r 058c2468b2f5 -r 5c9c71cde1c9 rust/hgcli/src/main.rs --- a/rust/hgcli/src/main.rs Fri Oct 04 16:07:32 2019 -0400 +++ b/rust/hgcli/src/main.rs Sat Oct 05 17:01:02 2019 -0400 @@ -104,19 +104,6 @@ } } -fn update_encoding(_py: Python, _sys_mod: &PyModule) { - // Call sys.setdefaultencoding("undefined") if HGUNICODEPEDANTRY is set. - let pedantry = env::var("HGUNICODEPEDANTRY").is_ok(); - - if pedantry { - // site.py removes the sys.setdefaultencoding attribute. So we need - // to reload the module to get a handle on it. This is a lesser - // used feature and we'll support this later. - // TODO support this - panic!("HGUNICODEPEDANTRY is not yet supported"); - } -} - fn update_modules_path(env: &Environment, py: Python, sys_mod: &PyModule) { let sys_path = sys_mod.get(py, "path").unwrap(); sys_path @@ -210,7 +197,6 @@ fn run_py(env: &Environment, py: Python) -> PyResult<()> { let sys_mod = py.import("sys").unwrap(); - update_encoding(py, &sys_mod); update_modules_path(&env, py, &sys_mod); // TODO consider a better error message on failure to import. diff -r 058c2468b2f5 -r 5c9c71cde1c9 tests/run-tests.py --- a/tests/run-tests.py Fri Oct 04 16:07:32 2019 -0400 +++ b/tests/run-tests.py Sat Oct 05 17:01:02 2019 -0400 @@ -80,13 +80,6 @@ import pipes shellquote = pipes.quote -if os.environ.get('RTUNICODEPEDANTRY', False): - try: - reload(sys) - sys.setdefaultencoding("undefined") - except NameError: - pass - processlock = threading.Lock() pygmentspresent = False