[Jython-checkins] jython: Restore support for non-printing characters in exeption messages.

jeff.allen jython-checkins at python.org
Wed Jun 7 04:22:33 EDT 2017


https://hg.python.org/jython/rev/c558ce4072ee
changeset:   8104:c558ce4072ee
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Wed Jun 07 08:29:12 2017 +0100
summary:
  Restore support for non-printing characters in exeption messages.

This removes an obsolete defence against encoding errors during the
processing of exceptions, which is now dealt with in Py.dispayException.

files:
  src/org/python/core/Py.java |  7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)


diff --git a/src/org/python/core/Py.java b/src/org/python/core/Py.java
--- a/src/org/python/core/Py.java
+++ b/src/org/python/core/Py.java
@@ -1507,14 +1507,13 @@
 
     /** Defensive method to avoid exceptions from decoding (or import encodings) */
     private static String asMessageString(PyObject value, boolean useRepr) {
-        if (useRepr)
+        if (useRepr) {
             value = value.__repr__();
+        }
         if (value instanceof PyUnicode) {
             return value.asString();
         } else {
-            // Carefully avoid decoding errors that would swallow the intended message
-            String s = value.__str__().getString();
-            return PyString.encode_UnicodeEscape(s, false);
+            return value.__str__().getString();
         }
     }
 

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list