[Jython-checkins] jython (merge 2.5 -> 2.5): Merge.

frank.wierzbicki jython-checkins at python.org
Sat Feb 9 02:05:55 CET 2013


http://hg.python.org/jython/rev/82e53a609c9b
changeset:   7020:82e53a609c9b
branch:      2.5
parent:      7017:041760b4c0d7
parent:      7013:f9c6dc60c4eb
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Fri Feb 08 17:05:16 2013 -0800
summary:
  Merge.

files:
  Lib/test/test_threading_jy.py                    |   9 ++++++
  NEWS                                             |   4 ++
  src/org/python/modules/_threading/Condition.java |  14 ++++++---
  3 files changed, 22 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_threading_jy.py b/Lib/test/test_threading_jy.py
--- a/Lib/test/test_threading_jy.py
+++ b/Lib/test/test_threading_jy.py
@@ -43,6 +43,15 @@
     def _sleep(self, n):
         time.sleep(random.random())
 
+    def test_issue1988(self):
+        cond = threading.Condition(threading.Lock())
+        locked = False
+        try:
+            locked = cond.acquire(False)
+        finally:
+            if locked:
+                cond.release()
+
 
 class TwistedTestCase(unittest.TestCase):
     
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@
 Jython 2.7a1
   Bugs Fixed
 
+Jython 2.5.4rc2
+  Bugs Fixed
+    - [ 1988 ] API for threading.condition fails to accept *args for acquire
+
 Jython 2.5.4rc1
   Bugs Fixed
     - [ 1936 ] JBoss 7, vfs protocol in use for jarFileName in PySystemState.
diff --git a/src/org/python/modules/_threading/Condition.java b/src/org/python/modules/_threading/Condition.java
--- a/src/org/python/modules/_threading/Condition.java
+++ b/src/org/python/modules/_threading/Condition.java
@@ -38,12 +38,16 @@
     }
 
     public boolean acquire() {
-        return Condition_acquire();
+        return Condition_acquire(true);
     }
 
-    @ExposedMethod
-    final boolean Condition_acquire() {
-        return _lock.acquire();
+    public boolean acquire(boolean blocking) {
+        return Condition_acquire(blocking);
+    }
+
+    @ExposedMethod(defaults = "true")
+    final boolean Condition_acquire(boolean blocking) {
+        return _lock.acquire(blocking);
     }
 
     public PyObject __enter__(ThreadState ts) {
@@ -53,7 +57,7 @@
 
     @ExposedMethod
     final PyObject Condition___enter__() {
-        Condition_acquire();
+        Condition_acquire(true);
         return this;
     }
 

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


More information about the Jython-checkins mailing list