[pypy-commit] pypy py3.5: _thread.error is RuntimeError, now

arigo pypy.commits at gmail.com
Wed Feb 1 08:37:14 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89880:20483147e347
Date: 2017-02-01 14:36 +0100
http://bitbucket.org/pypy/pypy/changeset/20483147e347/

Log:	_thread.error is RuntimeError, now

diff --git a/pypy/module/thread/__init__.py b/pypy/module/thread/__init__.py
--- a/pypy/module/thread/__init__.py
+++ b/pypy/module/thread/__init__.py
@@ -24,7 +24,7 @@
         '_set_sentinel':          'os_lock._set_sentinel',
         '_local':                 'os_local.Local',
         'TIMEOUT_MAX':            'space.wrap(float(os_lock.TIMEOUT_MAX // 1000000))',
-        'error':                  'space.fromcache(error.Cache).w_error',
+        'error':                  'space.w_RuntimeError',
     }
 
     def __init__(self, space, *args):
diff --git a/pypy/module/thread/error.py b/pypy/module/thread/error.py
--- a/pypy/module/thread/error.py
+++ b/pypy/module/thread/error.py
@@ -1,9 +1,5 @@
 from pypy.interpreter.error import OperationError
 
-class Cache:
-    def __init__(self, space):
-        self.w_error = space.new_exception_class("thread.error")
-
 def wrap_thread_error(space, msg):
-    w_error = space.fromcache(Cache).w_error
+    w_error = space.w_RuntimeError    # since CPython 3.3
     return OperationError(w_error, space.wrap(msg))
diff --git a/pypy/module/thread/test/test_thread.py b/pypy/module/thread/test/test_thread.py
--- a/pypy/module/thread/test/test_thread.py
+++ b/pypy/module/thread/test/test_thread.py
@@ -34,6 +34,10 @@
             time.sleep(0.2)
             remaining = thread._count()
 
+    def test_thread_error(self):
+        import _thread
+        assert _thread.error is RuntimeError   # uh, since CPython 3.3
+
     def test_start_new_thread(self):
         import _thread
         feedback = []


More information about the pypy-commit mailing list