50
50
import com .oracle .graal .python .builtins .objects .code .PCode ;
51
51
import com .oracle .graal .python .builtins .objects .common .SequenceStorageNodes ;
52
52
import com .oracle .graal .python .builtins .objects .dict .PDict ;
53
+ import com .oracle .graal .python .builtins .objects .exception .OSErrorEnum ;
53
54
import com .oracle .graal .python .builtins .objects .function .PArguments ;
54
55
import com .oracle .graal .python .builtins .objects .list .PList ;
55
56
import com .oracle .graal .python .builtins .objects .module .PythonModule ;
@@ -445,7 +446,12 @@ public PCode doit(VirtualFrame frame, PZipImporter self, String fullname,
445
446
CompilerDirectives .transferToInterpreterAndInvalidate ();
446
447
compileNode = insert (CompileNode .create (false ));
447
448
}
448
- ModuleCodeData md = self .getModuleCode (fullname );
449
+ ModuleCodeData md ;
450
+ try {
451
+ md = self .getModuleCode (fullname );
452
+ } catch (IOException e ) {
453
+ throw raiseOSError (frame , OSErrorEnum .EIO , e );
454
+ }
449
455
if (canNotFind .profile (md == null )) {
450
456
throw raise (PythonErrorType .ZipImportError , " can't find module '%s'" , fullname );
451
457
}
@@ -529,13 +535,18 @@ public PBytes doit(PZipImporter self, String pathname) {
529
535
public abstract static class GetFileNameNode extends PythonBinaryBuiltinNode {
530
536
531
537
@ Specialization
532
- public Object doit (PZipImporter self , String fullname ,
538
+ public Object doit (VirtualFrame frame , PZipImporter self , String fullname ,
533
539
@ Cached ("createBinaryProfile()" ) ConditionProfile canNotFind ,
534
540
@ Cached ("createBinaryProfile()" ) ConditionProfile initWasNotCalled ) {
535
541
if (initWasNotCalled .profile (self .getPrefix () == null )) {
536
542
throw raise (PythonErrorType .ValueError , INIT_WAS_NOT_CALLED );
537
543
}
538
- ModuleCodeData moduleCodeData = self .getModuleCode (fullname );
544
+ ModuleCodeData moduleCodeData ;
545
+ try {
546
+ moduleCodeData = self .getModuleCode (fullname );
547
+ } catch (IOException e ) {
548
+ throw raiseOSError (frame , OSErrorEnum .EIO , e );
549
+ }
539
550
if (canNotFind .profile (moduleCodeData == null )) {
540
551
throw raise (PythonErrorType .ZipImportError , " can't find module '%s'" , fullname );
541
552
}
@@ -550,13 +561,18 @@ public Object doit(PZipImporter self, String fullname,
550
561
public abstract static class GetSourceNode extends PythonBinaryBuiltinNode {
551
562
552
563
@ Specialization
553
- public String doit (PZipImporter self , String fullname ,
564
+ public String doit (VirtualFrame frame , PZipImporter self , String fullname ,
554
565
@ Cached ("createBinaryProfile()" ) ConditionProfile canNotFind ,
555
566
@ Cached ("createBinaryProfile()" ) ConditionProfile initWasNotCalled ) {
556
567
if (initWasNotCalled .profile (self .getPrefix () == null )) {
557
568
throw raise (PythonErrorType .ValueError , INIT_WAS_NOT_CALLED );
558
569
}
559
- ModuleCodeData md = self .getModuleCode (fullname );
570
+ ModuleCodeData md ;
571
+ try {
572
+ md = self .getModuleCode (fullname );
573
+ } catch (IOException e ) {
574
+ throw raiseOSError (frame , OSErrorEnum .EIO , e );
575
+ }
560
576
if (canNotFind .profile (md == null )) {
561
577
throw raise (PythonErrorType .ZipImportError , "can't find module '%s'" , fullname );
562
578
}
0 commit comments