]> granicus.if.org Git - python/commitdiff
Followup to issue #11140 and r88682: also patch _dummy_thread.
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 1 Mar 2011 23:05:42 +0000 (23:05 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 1 Mar 2011 23:05:42 +0000 (23:05 +0000)
Patch by Aymeric Augustin.

Lib/_dummy_thread.py
Lib/test/test_dummy_thread.py
Misc/ACKS
Misc/NEWS

index ed50520ab322ada9a701e500c00091e0a93de521..13b1f26965a201019ab3ccf91e7a6da2fb51ee8f 100644 (file)
@@ -24,11 +24,7 @@ TIMEOUT_MAX = 2**31
 # imports are done when needed on a function-by-function basis.  Since threads
 # are disabled, the import lock should not be an issue anyway (??).
 
-class error(Exception):
-    """Dummy implementation of _thread.error."""
-
-    def __init__(self, *args):
-        self.args = args
+error = RuntimeError
 
 def start_new_thread(function, args, kwargs={}):
     """Dummy implementation of _thread.start_new_thread().
index c61078d62011bb2e72c6a26a8588cd6a8281569a..2fafe1df8568fd585cc8d002d7a78b12ad8a88f6 100644 (file)
@@ -35,8 +35,8 @@ class LockTests(unittest.TestCase):
                         "Lock object did not release properly.")
 
     def test_improper_release(self):
-        #Make sure release of an unlocked thread raises _thread.error
-        self.assertRaises(_thread.error, self.lock.release)
+        #Make sure release of an unlocked thread raises RuntimeError
+        self.assertRaises(RuntimeError, self.lock.release)
 
     def test_cond_acquire_success(self):
         #Make sure the conditional acquiring of the lock works.
index f2b15d3f5e21c77ed8e1f05fca3bec9640b3ac8d..776b9ae21c765c9946f4dfa1f0427b7cf3c8a95d 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -35,6 +35,7 @@ Jon Anglin
 Jason Asbahr
 David Ascher
 Chris AtLee
+Aymeric Augustin
 John Aycock
 Jan-Hein Bührman
 Donovan Baarda
index 0f73b316acb3dd0b433f3b976529fe5e5b6d98ef..0e83bbf457a3a67853c817b5f05cbe7b7b1a7c43 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -44,7 +44,7 @@ Library
 - Issue #11140: Lock.release() now raises a RuntimeError when attempting
   to release an unacquired lock, as claimed in the threading documentation.
   The _thread.error exception is now an alias of RuntimeError.  Patch by
-  Filip Gruszczyński.
+  Filip Gruszczyński.  Patch for _dummy_thread by Aymeric Augustin.
 
 - Issue 8594: ftplib now provides a source_address parameter to specify which
   (address, port) to bind to before connecting.