diff Modules/_threadmodule.c @ 68191:2ddca55e098d

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.
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 28 Feb 2011 22:03:34 +0000
parents e2f96bd29252
children b39270c6b8d1
line wrap: on
line diff
--- a/Modules/_threadmodule.c	Mon Feb 28 19:27:16 2011 +0000
+++ b/Modules/_threadmodule.c	Mon Feb 28 22:03:34 2011 +0000
@@ -1308,7 +1308,9 @@
 
     /* Add a symbolic constant */
     d = PyModule_GetDict(m);
-    ThreadError = PyErr_NewException("_thread.error", NULL, NULL);
+    ThreadError = PyExc_RuntimeError;
+    Py_INCREF(ThreadError);
+    
     PyDict_SetItemString(d, "error", ThreadError);
     Locktype.tp_doc = lock_doc;
     Py_INCREF(&Locktype);