File tree Expand file tree Collapse file tree 4 files changed +31
-3
lines changed
com.oracle.graal.python.test/src/tests/unittest_tags
com.oracle.graal.python/src/com/oracle/graal/python/builtins Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change
1
+ *AttributesTest.test_blockingioerror
1
2
*AttributesTest.test_errno_translation
2
3
*AttributesTest.test_posix_error
3
4
*AttributesTest.test_windows_error
4
5
*ExplicitSubclassingTest.test_errno_mapping
5
6
*ExplicitSubclassingTest.test_init_kwdargs
7
+ *ExplicitSubclassingTest.test_init_new_overridden
8
+ *ExplicitSubclassingTest.test_init_overridden
9
+ *ExplicitSubclassingTest.test_init_standalone
10
+ *ExplicitSubclassingTest.test_new_kwdargs
11
+ *ExplicitSubclassingTest.test_new_overridden
6
12
*HierarchyTest.test_builtin_errors
7
13
*HierarchyTest.test_errno_mapping
14
+ *HierarchyTest.test_select_error
15
+ *HierarchyTest.test_socket_errors
8
16
*HierarchyTest.test_try_except
Original file line number Diff line number Diff line change @@ -168,6 +168,9 @@ public enum PythonBuiltinClassType implements LazyPythonClass {
168
168
ZLibError ("error" , "zlib" ),
169
169
LZMAError ("LZMAError" , "_lzma" ),
170
170
StructError ("StructError" , "_struct" ),
171
+ SocketGAIError ("gaierror" , "_socket" ),
172
+ SocketHError ("herror" , "_socket" ),
173
+ SocketTimeout ("timeout" , "_socket" ),
171
174
172
175
// todo: all OS errors
173
176
@@ -318,6 +321,9 @@ public final DynamicObject newInstance() {
318
321
ZipImportError .base = ImportError ;
319
322
ZLibError .base = Exception ;
320
323
LZMAError .base = Exception ;
324
+ SocketGAIError .base = OSError ;
325
+ SocketHError .base = OSError ;
326
+ SocketTimeout .base = OSError ;
321
327
322
328
ReferenceError .base = Exception ;
323
329
RuntimeError .base = Exception ;
Original file line number Diff line number Diff line change 66
66
import com .oracle .graal .python .nodes .function .PythonBuiltinNode ;
67
67
import com .oracle .graal .python .nodes .util .CoerceToDoubleNode ;
68
68
import com .oracle .graal .python .nodes .util .CoerceToFileDescriptorNode ;
69
+ import com .oracle .graal .python .runtime .exception .PythonErrorType ;
69
70
import com .oracle .graal .python .runtime .sequence .PSequence ;
70
71
import com .oracle .graal .python .runtime .sequence .storage .IntSequenceStorage ;
71
72
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
80
81
81
82
@ CoreFunctions (defineModule = "select" )
82
83
public class SelectModuleBuiltins extends PythonBuiltins {
84
+
85
+ public SelectModuleBuiltins () {
86
+ builtinConstants .put ("error" , PythonErrorType .OSError );
87
+ }
88
+
83
89
@ Override
84
90
protected List <? extends NodeFactory <? extends PythonBuiltinBaseNode >> getNodeFactories () {
85
91
return SelectModuleBuiltinsFactory .getFactories ();
Original file line number Diff line number Diff line change @@ -131,26 +131,34 @@ def _oserror_use_init(subtype):
131
131
132
132
def _oserror_init (self , * arg ):
133
133
narg = len (arg )
134
+ self .args = arg
134
135
self .errno = None
135
136
self .strerror = None
136
137
self .filename = None
137
138
self .filename2 = None
138
139
if (2 <= narg and narg <= 5 ):
140
+ self .args = arg [0 :2 ]
139
141
self .errno = arg [0 ]
140
142
self .strerror = arg [1 ]
141
143
if (narg >= 5 ):
142
144
self .filename2 = arg [4 ]
143
145
if (narg >= 3 ):
144
- self .filename = arg [2 ]
146
+ if type (self ) == BlockingIOError :
147
+ try :
148
+ self .characters_written = arg [2 ].__index__ ()
149
+ except Exception :
150
+ self .filename = arg [2 ]
151
+ else :
152
+ self .filename = arg [2 ]
145
153
146
154
def OSError__new__ (subtype , * args , ** kwds ):
147
155
newtype = subtype
148
156
if (not _oserror_use_init (newtype ) and len (args ) > 1 ):
149
157
myerrno = args [0 ]
150
158
if (type (myerrno ) is int and subtype is OSError and myerrno in _errnomap ):
151
159
newtype = _errnomap [myerrno ]
152
-
153
- self = BaseException .__new__ (newtype , * args , ** kwds )
160
+
161
+ self = BaseException .__new__ (newtype )
154
162
self .errno = self .strerror = self .filename = self .filename2 = None
155
163
if (not _oserror_use_init (newtype )):
156
164
_oserror_init (self , * args )
You can’t perform that action at this time.
0 commit comments