Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce0a6de

Browse files
committed
never close the file in imp.load_...
1 parent a83f270 commit ce0a6de

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

Python/import.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,6 @@ imp_load_compiled(self, args)
857857
if (fp == NULL)
858858
return NULL;
859859
m = load_compiled_module(name, pathname, fp);
860-
if (fob == NULL)
861-
fclose(fp);
862860
return m;
863861
}
864862

@@ -877,8 +875,6 @@ imp_load_dynamic(self, args)
877875
if (fob)
878876
fp = get_file(pathname, fob, "r");
879877
m = load_dynamic_module(name, pathname, fp);
880-
if (fob == NULL)
881-
fclose(fp);
882878
return m;
883879
}
884880

@@ -898,8 +894,6 @@ imp_load_source(self, args)
898894
if (fp == NULL)
899895
return NULL;
900896
m = load_source_module(name, pathname, fp);
901-
if (fob == NULL)
902-
fclose(fp);
903897
return m;
904898
}
905899

0 commit comments

Comments
 (0)