Author: Armin Rigo <ar...@tunes.org>
Branch: stm-thread-2
Changeset: r61312:43ffd21dc40e
Date: 2013-02-16 10:54 +0100
http://bitbucket.org/pypy/pypy/changeset/43ffd21dc40e/

Log:    Move thread.atomic to __pypy__.thread.atomic.

diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py
--- a/pypy/module/__pypy__/__init__.py
+++ b/pypy/module/__pypy__/__init__.py
@@ -29,10 +29,16 @@
 class ThreadModule(MixedModule):
     appleveldefs = {
         'signals_enabled': 'app_signal.signals_enabled',
+        'atomic':                  'app_atomic.atomic',
+        'exclusive_atomic':        'app_atomic.exclusive_atomic',
+        'error':                   'app_atomic.error',
     }
     interpleveldefs = {
         '_signals_enter':  'interp_signal.signals_enter',
         '_signals_exit':   'interp_signal.signals_exit',
+        '_atomic_enter':           'interp_atomic.atomic_enter',
+        '_exclusive_atomic_enter': 'interp_atomic.exclusive_atomic_enter',
+        '_atomic_exit':            'interp_atomic.atomic_exit',
     }
 
 
diff --git a/pypy/module/thread/app_atomic.py 
b/pypy/module/__pypy__/app_atomic.py
rename from pypy/module/thread/app_atomic.py
rename to pypy/module/__pypy__/app_atomic.py
--- a/pypy/module/thread/app_atomic.py
+++ b/pypy/module/__pypy__/app_atomic.py
@@ -1,4 +1,5 @@
-import thread
+from thread import error     # re-exported
+from __pypy__ import thread
 
 class Atomic(object):
     __enter__ = thread._atomic_enter
diff --git a/pypy/module/thread/atomic.py 
b/pypy/module/__pypy__/interp_atomic.py
rename from pypy/module/thread/atomic.py
rename to pypy/module/__pypy__/interp_atomic.py
diff --git a/pypy/module/thread/test/test_atomic.py 
b/pypy/module/__pypy__/test/test_atomic.py
rename from pypy/module/thread/test/test_atomic.py
rename to pypy/module/__pypy__/test/test_atomic.py
--- a/pypy/module/thread/test/test_atomic.py
+++ b/pypy/module/__pypy__/test/test_atomic.py
@@ -5,7 +5,7 @@
 class AppTestAtomic(GenericTestThread):
 
     def test_simple(self):
-        import thread
+        from __pypy__ import thread
         for atomic in thread.atomic, thread.exclusive_atomic:
             with atomic:
                 pass
@@ -16,20 +16,20 @@
                 pass
 
     def test_nest_composable_atomic(self):
-        import thread
+        from __pypy__ import thread
         with thread.atomic:
             with thread.atomic:
                 pass
 
     def test_nest_composable_below_exclusive(self):
-        import thread
+        from __pypy__ import thread
         with thread.exclusive_atomic:
             with thread.atomic:
                 with thread.atomic:
                     pass
 
     def test_nest_exclusive_fails(self):
-        import thread
+        from __pypy__ import thread
         try:
             with thread.exclusive_atomic:
                 with thread.exclusive_atomic:
@@ -38,7 +38,7 @@
             assert e.message == "exclusive_atomic block can't be entered 
inside another atomic block"
 
     def test_nest_exclusive_fails2(self):
-        import thread
+        from __pypy__ import thread
         try:
             with thread.atomic:
                 with thread.exclusive_atomic:
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
@@ -4,8 +4,6 @@
 
 class Module(MixedModule):
     appleveldefs = {
-        'atomic':                 'app_atomic.atomic',
-        'exclusive_atomic':       'app_atomic.exclusive_atomic',
     }
 
     interpleveldefs = {
@@ -22,9 +20,6 @@
         'LockType':               'os_lock.Lock',
         '_local':                 'os_local.Local',
         'error':                  'space.fromcache(error.Cache).w_error',
-        '_atomic_enter':          'atomic.atomic_enter',
-        '_exclusive_atomic_enter': 'atomic.exclusive_atomic_enter',
-        '_atomic_exit':           'atomic.atomic_exit',
     }
 
     def __init__(self, space, *args):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to