6767import com .oracle .graal .python .nodes .function .PythonBuiltinNode ;
6868import com .oracle .graal .python .runtime .exception .PythonErrorType ;
6969import com .oracle .graal .python .runtime .sequence .PSequence ;
70- import com .oracle .graal .python .runtime .sequence .storage .IntSequenceStorage ;
7170import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
7271import com .oracle .truffle .api .CompilerDirectives .ValueType ;
7372import com .oracle .truffle .api .dsl .Cached ;
@@ -226,12 +225,13 @@ private ChannelFD[] seq2set(VirtualFrame frame, Object sequence, PythonObjectLib
226225 PSequence pSequence = constructListNode .execute (sequence );
227226
228227 for (int i = 0 ; i < len ; i ++) {
229- int fd = itemLib .asFileDescriptorWithState (callGetItemNode .executeObject (frame , pSequence , i ), threadState );
228+ Object pythonObject = callGetItemNode .executeObject (frame , pSequence , i );
229+ int fd = itemLib .asFileDescriptorWithState (pythonObject , threadState );
230230 Channel fileChannel = getContext ().getResources ().getFileChannel (fd );
231231 if (!(fileChannel instanceof SelectableChannel )) {
232232 throw NonSelectableChannel .INSTANCE ;
233233 }
234- result [i ] = new ChannelFD (fd , (SelectableChannel ) fileChannel );
234+ result [i ] = new ChannelFD (pythonObject , (SelectableChannel ) fileChannel );
235235 }
236236 return result ;
237237 }
@@ -243,13 +243,13 @@ private PList toList(ChannelFD[] arr) {
243243 cnt ++;
244244 }
245245 }
246- int [] fds = new int [cnt ];
246+ Object [] fds = new Object [cnt ];
247247 for (ChannelFD channelFD : arr ) {
248248 if (channelFD != null ) {
249- fds [fds .length - (cnt --)] = channelFD .fd ;
249+ fds [fds .length - (cnt --)] = channelFD .pythonObject ;
250250 }
251251 }
252- return factory ().createList (new IntSequenceStorage ( fds ) );
252+ return factory ().createList (fds );
253253 }
254254
255255 static LookupAndCallBinaryNode createGetItem () {
@@ -258,11 +258,11 @@ static LookupAndCallBinaryNode createGetItem() {
258258
259259 @ ValueType
260260 private static final class ChannelFD {
261- private final int fd ;
261+ private final Object pythonObject ;
262262 private final SelectableChannel channel ;
263263
264- private ChannelFD (int fd , SelectableChannel channel ) {
265- this .fd = fd ;
264+ private ChannelFD (Object pythonObject , SelectableChannel channel ) {
265+ this .pythonObject = pythonObject ;
266266 this .channel = channel ;
267267 }
268268 }
0 commit comments