D6991: hg: remove HGUNICODEPEDANTRY and RTUNICODEPEDANTRY

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Oct 6 11:06:59 EDT 2019


Closed by commit rHG5c9c71cde1c9: hg: remove HGUNICODEPEDANTRY and RTUNICODEPEDANTRY (authored by indygreg).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6991?vs=16862&id=16895

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6991/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6991

AFFECTED FILES
  hg
  rust/hgcli/src/main.rs
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -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
diff --git a/rust/hgcli/src/main.rs b/rust/hgcli/src/main.rs
--- a/rust/hgcli/src/main.rs
+++ b/rust/hgcli/src/main.rs
@@ -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 --git a/hg b/hg
--- a/hg
+++ b/hg
@@ -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' '@':



To: indygreg, #hg-reviewers, pulkit
Cc: durin42, mercurial-devel, kevincox


More information about the Mercurial-devel mailing list