[pypy-svn] r8526 - in pypy/dist/pypy: interpreter module

arigo at codespeak.net arigo at codespeak.net
Mon Jan 24 14:32:26 CET 2005


Author: arigo
Date: Mon Jan 24 14:32:26 2005
New Revision: 8526

Modified:
   pypy/dist/pypy/interpreter/error.py
   pypy/dist/pypy/module/sysinterp.py
   pypy/dist/pypy/module/sysmodule.py
Log:
Implemented sys.exc_clear().


Modified: pypy/dist/pypy/interpreter/error.py
==============================================================================
--- pypy/dist/pypy/interpreter/error.py	(original)
+++ pypy/dist/pypy/interpreter/error.py	Mon Jan 24 14:32:26 2005
@@ -27,6 +27,12 @@
         self.application_traceback = tb
         self.debug_excs = []
 
+    def clear(self, space):
+        # for sys.exc_clear()
+        self.w_type = space.w_None
+        self.w_value = space.w_None
+        self.application_traceback = None
+
     def match(self, space, w_check_class):
         "Check if this application-level exception matches 'w_check_class'."
         return space.exception_match(self.w_type, w_check_class)

Modified: pypy/dist/pypy/module/sysinterp.py
==============================================================================
--- pypy/dist/pypy/module/sysinterp.py	(original)
+++ pypy/dist/pypy/module/sysinterp.py	Mon Jan 24 14:32:26 2005
@@ -153,6 +153,11 @@
         return space.newtuple([operror.w_type,operror.w_value,
                                space.wrap(operror.application_traceback)])
 
+def exc_clear():
+    operror = space.getexecutioncontext().sys_exc_info()
+    if operror is not None:
+        operror.clear(space)
+
 def pypy_getudir():
     from pypy.tool.udir import udir
     return space.wrap(str(udir))

Modified: pypy/dist/pypy/module/sysmodule.py
==============================================================================
--- pypy/dist/pypy/module/sysmodule.py	(original)
+++ pypy/dist/pypy/module/sysmodule.py	Mon Jan 24 14:32:26 2005
@@ -15,7 +15,7 @@
 from __interplevel__ import pypy_objspaceclass
 
 # Functions from interpreter-level
-from __interplevel__ import _getframe, exc_info, pypy_getudir
+from __interplevel__ import _getframe, exc_info, exc_clear, pypy_getudir
 from __interplevel__ import _getframe, getrecursionlimit, setrecursionlimit
 
 # Dummy



More information about the Pypy-commit mailing list