[Jython-checkins] jython: Implemented workaround for #2536 by adding warning and skipping dangerous

stefan.richthofer jython-checkins at python.org
Wed May 24 13:30:03 EDT 2017


https://hg.python.org/jython/rev/2b06bc95594d
changeset:   8095:2b06bc95594d
user:        Stefan Richthofer <stefan.richthofer at gmx.de>
date:        Wed May 24 19:29:21 2017 +0200
summary:
  Implemented workaround for #2536 by adding warning and skipping dangerous tests. Issue is kept open to discuss better future solutions.

files:
  Lib/json/tests/test_recursion.py     |  5 +++++
  Lib/test/test_isinstance.py          |  2 ++
  NEWS                                 |  1 +
  src/org/python/core/PyTableCode.java |  6 ++++++
  4 files changed, 14 insertions(+), 0 deletions(-)


diff --git a/Lib/json/tests/test_recursion.py b/Lib/json/tests/test_recursion.py
--- a/Lib/json/tests/test_recursion.py
+++ b/Lib/json/tests/test_recursion.py
@@ -1,4 +1,6 @@
 from json.tests import PyTest, CTest
+import unittest
+from test import test_support
 
 
 class JSONTestObject:
@@ -65,6 +67,7 @@
             self.fail("didn't raise ValueError on default recursion")
 
 
+    @unittest.skipIf(test_support.is_jython, "See http://bugs.jython.org/issue2536.")
     def test_highly_nested_objects_decoding(self):
         # test that loading highly-nested objects doesn't segfault when C
         # accelerations are used. See #12017
@@ -83,6 +86,7 @@
         with self.assertRaises(RuntimeError):
             self.loads(u'[' * 100000 + u'1' + u']' * 100000)
 
+    @unittest.skipIf(test_support.is_jython, "See http://bugs.jython.org/issue2536.")
     def test_highly_nested_objects_encoding(self):
         # See #12051
         l, d = [], {}
@@ -93,6 +97,7 @@
         with self.assertRaises(RuntimeError):
             self.dumps(d)
 
+    @unittest.skipIf(test_support.is_jython, "See http://bugs.jython.org/issue2536.")
     def test_endless_recursion(self):
         # See #12051
         class EndlessJSONEncoder(self.json.JSONEncoder):
diff --git a/Lib/test/test_isinstance.py b/Lib/test/test_isinstance.py
--- a/Lib/test/test_isinstance.py
+++ b/Lib/test/test_isinstance.py
@@ -246,11 +246,13 @@
         if test_support.have_unicode:
             self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring))))
 
+    @unittest.skipIf(test_support.is_jython, "See http://bugs.jython.org/issue2536.")
     def test_subclass_recursion_limit(self):
         # make sure that issubclass raises RuntimeError before the C stack is
         # blown
         self.assertRaises(RuntimeError, blowstack, issubclass, str, str)
 
+    @unittest.skipIf(test_support.is_jython, "See http://bugs.jython.org/issue2536.")
     def test_isinstance_recursion_limit(self):
         # make sure that issubclass raises RuntimeError before the C stack is
         # blown
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@
 
 Jython 2.7.1rc1
   Bugs fixed
+    - [ 2536 ] deadlocks in regrtests due to StackOverflowError in finally block (workaround, still open)
     - [ 2356 ] java.lang.IllegalArgumentException on startup on Windows if username not ASCII
     - [ 1839 ] sys.getfilesystemencoding() is None (now utf-8)
     - [ 2579 ] Pyc files are not loading for too large modules if path contains __pyclasspath__
diff --git a/src/org/python/core/PyTableCode.java b/src/org/python/core/PyTableCode.java
--- a/src/org/python/core/PyTableCode.java
+++ b/src/org/python/core/PyTableCode.java
@@ -171,6 +171,12 @@
             ret = funcs.call_function(func_id, frame, ts);
         } catch (Throwable t) {
             // Convert exceptions that occurred in Java code to PyExceptions
+            if (!(t instanceof Exception)) {
+                Py.warning(Py.RuntimeWarning, "PyTableCode.call caught a Throwable that is "
+                        + "not an Exception:\n"+t+"\nJython internals might be in a bad state now "
+                        + "that can cause deadlocks later on."
+                        + "\nSee http://bugs.jython.org/issue2536 for details.");
+            }
             PyException pye = Py.JavaError(t);
             pye.tracebackHere(frame);
 

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


More information about the Jython-checkins mailing list