[Jython-checkins] jython: marshal to raise error when fed unmarshalable object. Fixes #2077.

jeff.allen jython-checkins at python.org
Sat Mar 23 04:50:15 EDT 2019


https://hg.python.org/jython/rev/f5dda19d78c9
changeset:   8228:f5dda19d78c9
user:        Andrew Kuchling <amk at amk.ca>
date:        Fri Mar 22 07:50:54 2019 +0000
summary:
  marshal to raise error when fed unmarshalable object. Fixes #2077.

files:
  ACKNOWLEDGMENTS                      |  1 +
  NEWS                                 |  1 +
  src/org/python/modules/_marshal.java |  4 +---
  3 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/ACKNOWLEDGMENTS b/ACKNOWLEDGMENTS
--- a/ACKNOWLEDGMENTS
+++ b/ACKNOWLEDGMENTS
@@ -183,6 +183,7 @@
     Richie Bendall
     Raymond Ferguson
     yishenggudou (愧僧)
+    Andrew Kuchling
 
 Local Variables:
 mode: indented-text
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@
 
 Development tip
   Bugs fixed
+    - [ 2077 ] marshal doesn't raise error when fed unmarshalable object
     - [ 2445 ] Eclipse's DelegatingFeatureMap has MRO conflict
     - [ 2732 ] Regression in large module support for pip
     - [ GH-131 ] Support Unicode in zxJDBC exceptions.
diff --git a/src/org/python/modules/_marshal.java b/src/org/python/modules/_marshal.java
--- a/src/org/python/modules/_marshal.java
+++ b/src/org/python/modules/_marshal.java
@@ -46,7 +46,6 @@
     private final static char TYPE_DICT = '{';
     private final static char TYPE_CODE = 'c';
     private final static char TYPE_UNICODE = 'u';
-    private final static char TYPE_UNKNOWN = '?';
     private final static char TYPE_SET = '<';
     private final static char TYPE_FROZENSET = '>';
     private final static int MAX_MARSHAL_STACK_DEPTH = 2000;
@@ -239,9 +238,8 @@
                 write_int(code.co_firstlineno);
                 write_object(Py.newString(new String(code.co_lnotab)), depth + 1);
             } else {
-                write_byte(TYPE_UNKNOWN);
+                throw Py.ValueError("unmarshallable object");
             }
-
             depth--;
         }
 

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


More information about the Jython-checkins mailing list