[pypy-svn] r64642 - in pypy/branch/unicode_filename/pypy: annotation interpreter

afa at codespeak.net afa at codespeak.net
Fri Apr 24 16:35:37 CEST 2009


Author: afa
Date: Fri Apr 24 16:35:36 2009
New Revision: 64642

Modified:
   pypy/branch/unicode_filename/pypy/annotation/classdef.py
   pypy/branch/unicode_filename/pypy/interpreter/baseobjspace.py
Log:
Add WindowsError attributes in FORCE_ATTRIBUTES_INTO_CLASSES.
This hack is needed to annotate pypy.interpreter.error.wrap_oserror().
Not sure why, here I imitated OSError just above.


Modified: pypy/branch/unicode_filename/pypy/annotation/classdef.py
==============================================================================
--- pypy/branch/unicode_filename/pypy/annotation/classdef.py	(original)
+++ pypy/branch/unicode_filename/pypy/annotation/classdef.py	Fri Apr 24 16:35:36 2009
@@ -442,6 +442,16 @@
     }
 
 try:
+    WindowsError
+except NameError:
+    pass
+else:
+    FORCE_ATTRIBUTES_INTO_CLASSES[WindowsError] = {
+        'winerror': SomeInteger(),
+        'strerror': SomeString(),
+        }
+
+try:
     import termios
 except ImportError:
     pass

Modified: pypy/branch/unicode_filename/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/branch/unicode_filename/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/branch/unicode_filename/pypy/interpreter/baseobjspace.py	Fri Apr 24 16:35:36 2009
@@ -1174,6 +1174,13 @@
     'ZeroDivisionError',
     ]
 
+try:
+    WindowsError
+except NameError:
+    pass
+else:
+    ObjSpace.ExceptionTable.append('WindowsError')
+
 ## Irregular part of the interface:
 #
 #                                   wrap(x) -> w_x



More information about the Pypy-commit mailing list